{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Linear Data Structures 1.6

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

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

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 # \$ % & ' (

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

View Full Document
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.
Last Updated: 12-01-17 9:52 AM CSE 2011 Prof. J. Elder - 28 - Stacks Chapter 5.1

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

View Full Document
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
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}