{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

316_Hash_Table_Notes

316_Hash_Table_Notes - Un-1 = Summation from i = 1 to m of...

This preview shows page 1. Sign up to view the full content.

Analysis of Open Addressing: Operations insert : unsuccessful search retrieve/delete : successful search Cost Measure # of record accesses (probes) required to insert/retrieve/delete a record Problem Size : load factor 1. Probability a record goes in home position goes down with increasing load factor 2. Average cost is a fn of how full the table is Average Cost Method 1 1. Decide what a case is 2. Sum cost for all cases 3. Divide by number of cases Method 2 1. Decide what a case is 2. Sum cost for all cases each weighted by the probability it happens Cost of Insertion (alpah)n - load factor after n records have been inserted Un - cost of unsuccesful search after n records have been inserted Sn - cost of successful search after n record have been inserted Avg # probes : Summation from i = 1 to m of i times probability i probes is enough Cost of inserting nth record: avg # probes in unsuccesful search when n-1 records are in Prob(bucket full) = load factor of n-1 Prob(bucket empty) = 1 - load factor of n-1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Un-1 = Summation from i = 1 to m of i times probability i probes is enough Un-1 <= Summation from i =0 to infinity of the load factor of n-1 to the ith power Un-1 <= 1/(1 - load factor of n-1) Un = 1/(1 - loadfactor) For load factor = .77, Un = about 5 Cost of Retrieval # probes to retrieve record R = # probes to insert R so we need the average cost of successful search in table of n entries (Sn) Sn = average # probes it took to insert each record which is average # probes in unsuccessful search when i-1 records are in Sn = (Summation from i = 1 to n of Ui-1) / n = (1 / n) Summation from i = 1 to n of 1 / (1 - load factor of i - 1) = (1 / load factor of n) * ln(1 / (1 - load factor of n)) load factor | Un = 1 / (1 - load factor) INSERT | Sn (from above) RETRIEVE .1 | 1.11 | 1.05 .2 | 1.25 | 1.12 .5 | 2 | 1.39 .6 | 2.5 | 1.53 .7 | 3.33 | 1.72 .8 | 5 | 2.01 .9 | 10 | 2.56 .99 | 100 | 4.65 .999 | 1000 | 6.91...
View Full Document

{[ snackBarMessage ]}