flâneur — a map of the web's best reading

Lecture 20: Amortized Analysis

cs.cornell.edu · 2,263 words · saved by 1 readers

The claim that hash tables have O(1) expected performance for lookup and insert is based on the assumption that the number of elements stored in the table is comparable to the number of buckets. If a hash table has many more elements than buckets, the number of elements stored at each bucket will become large. For instance, with a constant number of buckets and O(n) elements, the lookup time is O(n) and not O(1).

Lecture 20: Amortized Analysis Lecture 20: Amortized Analysis The claim that hash tables have O (1) expected performance for lookup and insert is based on the assumption that the number of elements stored in the table is comparable to the number of buckets. If a hash table has many more elements than buckets, the number of elements stored at each bucket will become large. For instance, with a constant number of buckets and O ( n ) elements, the lookup time is O ( n ) and not O (1). The solution to this problem is to increase the size of the table when the number of elements in the table gets t

Explore this link on the map →

related reading