jagomart
digital resources
picture1_Lecture04b


 134x       Filetype PPT       File size 0.16 MB       Source: courses.cs.washington.edu


File: Lecture04b
today finish amortized analysis of stretchy arrays the list adt reading assignment for this week weiss chapter 3 2 amortized analysis stack a e d c b a b c ...

icon picture PPT Filetype Power Point PPT | Posted on 09 Sep 2022 | 3 years ago
Partial capture of text on file.
                         Today
     • Finish amortized analysis of stretchy arrays
     • The List ADT
     Reading assignment for this week:
       Weiss, Chapter 3
                                                    2
                   Amortized Analysis
      Stack                    A                         E D C B A
                                      B
                                      C
      • Stack operations              D
         – push                       E
         – pop                        F           F
         – is_empty
      • Stack property: if x is on the stack before y is pushed, then 
        x will be popped after y is popped
         What is biggest problem with an array implementation?    3
       Stretchy Stack Implementation
  int[] data;
   int[] data;              Best case Push = O(   )
  int maxsize;
   int maxsize;
  int top;                  Worst case Push = O(   )
   int top;
  Push(e){
   Push(e){
    if (top == maxsize){
     if (top == maxsize){
        temp = new int[2*maxsize];
        temp = new int[2*maxsize];
        for (i=0;i
						
									
										
									
																
													
					
The words contained in this file might help you see if this file matches what you are looking for:

...Today finish amortized analysis of stretchy arrays the list adt reading assignment for this week weiss chapter stack a e d c b operations push pop f is empty property if x on before y pushed then will be popped after what biggest problem with an array implementation int data best case o maxsize top worst temp new i...

no reviews yet
Please Login to review.