Unformatted text preview: 3 4 1 ? 2 ? ? C[ ] 4 6 2 3 ? ? ? ? k=4
A[4]=99, A[6]=33, A[2]=22, and A[3]=55 initialized in that order
6 Appetizer
Theorem. A[i] is initialized iff both 1 ≤ B[i] ≤ k and C[B[i]] = i.
Pf. ⇐ ・Suppose A[i] is uninitialized.
・If B[i] < 1 or B[i] > k, then A[i] clearly uninitialized.
・If 1 ≤ B[i] ≤ k by coincidence, then we still can't have C[B[i]] = i because none of the entries C[1.. k] can equal i. ▪ 1 2 3 4 5 6 7 8 A[ ] ? 22 55 99 ? 33 ? ? B[ ] ? 3 4 1 ? 2 ? ? C[ ] 4 6 2 3 ? ? ? ? k=4
A[4]=99, A[6]=33, A[2]=22, and A[3]=55 initialized in that order
7 A MORTIZED A NALYSIS
‣ binary counter
‣ multipop stack
‣ dynamic table Copyright © 2013 Kevin Wayne
http://www.cs.princeton.edu/~wayne/kleinbergtardos Last updated on Sep 8, 2013 7:00 AM Amortized analysis
Worstcase analysis. Determine worstcase running time of a data structure
operation as function of the input size.
can be too pessimistic if the only way to
encounter an expensive operation is if there
were lots of previous cheap operations Amortized analysis. Determine worstcase running t...
View
Full
Document
This document was uploaded on 02/05/2014.
 Spring '14

Click to edit the document details