Lecture9

Lecture9 - Lecture 9, Oct 19 2010 Successful Search...

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

View Full Document Right Arrow Icon
1 102 Successful Search Expected time to find i -th element = time to insert i -th element Assume that the key being searched for is equally likely to be any one of the keys stored. Conditioned on “key was the i -th element inserted” » Conditional expectation = » Expectation: Intuition: need to search 1/2 of a list on the average. 1 1 i m    1 11 (1 ) 22 2 Pr[i-th element inserted] [time conditioned on i] 1 1 ( 1 ) n i nn ii m nm nm E i i m O       Lecture 9, Oct 19 2010 103 Choosing Hash Functions Mostly black magic… division method: h(k)=k mod m » Do not use m=2 p (will not use all the bits) » choose m=prime not too close to power of 2 or 10. Multiplication method: » choose m 2 p , 0 < A < 1 , not too close to 0 or 1 . » If m=2 P , then all we do is scramble by multiplication, and choose p bits to the left of binary point.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

Lecture9 - Lecture 9, Oct 19 2010 Successful Search...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online