{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Linear Data Structures 1.6

Linear Data Structures 1.6 - Doubling Strategy Analysis We...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Last Updated: 12-01-17 9:52 AM CSE 2011 Prof. J. Elder - 26 - Doubling Strategy Analysis We replace the array k = log 2 n times The total time T ( n ) of a series of n add(o) operations is proportional to n + 1 + 2 + 4 + 8 + …+ 2 k = n + 2 k + 1 1 = 3 n 1 Thus T ( n ) is O ( n ) The amortized time of an add operation is O (1)! geometric series 1 2 1 4 8 Recall: r i i = 0 n ! = 1 " r n + 1 1 " r # $ % & ' (
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Last Updated: 12-01-17 9:52 AM CSE 2011 Prof. J. Elder - 27 - Applications of Array Lists Maintaining a sorted list when insertions and removals are relatively rare.
Background image of page 2
Last Updated: 12-01-17 9:52 AM CSE 2011 Prof. J. Elder - 28 - Stacks Chapter 5.1
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Last Updated: 12-01-17 9:52 AM CSE 2011 Prof. J. Elder - 29 - The Stack ADT The Stack ADT stores arbitrary objects Insertions and deletions follow the last-in first-out
Background image of page 4
Background image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}