This preview shows page 1. Sign up to view the full content.
Unformatted text preview: than O ( 1 ) time for copying. In addition, we want to keep the table size small enough, avoiding a very large table to keep only few items. One way to manage a dynamic table is by the following rules: (a) Double the size of the table if an item is inserted into a full table (b) Halve the table size if a deletion causes the table to become less than 1 / 4 full Show that, in such a dynamic table we only need O ( 1 ) amortized time, per operation. 3. Consider a stack data structure with the following operations: • PUSH( x ): adds the element x to the top of the stack • POP: removes and returns the element that is currently on top of the stack (if the stack is nonempty) • SEARCH( x ): repeatedly removes the element on top of the stack until x is found or the stack becomes empty What is the amortized cost of an operation? 1...
View
Full
Document
This note was uploaded on 01/22/2012 for the course CS 573 taught by Professor Chekuri,c during the Fall '08 term at University of Illinois, Urbana Champaign.
 Fall '08
 Chekuri,C
 Algorithms

Click to edit the document details