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

§4 Open Addressing 2. Quadratic Probing f ( i ) = i 2 ; /* a quadratic function */ f ( i ) = i 2 ; /* a quadratic function */ Theorem 【 If quadratic probing is used, and the table size is prime , then a new element can always be inserted if the table is at least half empty . Proof: Just prove that the first TableSize/2 alternative locations are all distinct . That is, for any 0 < i j TableSize/2 , we have ( h ( x ) + i 2 ) % TableSize ( h ( x ) + j 2 ) % TableSize Suppose: h ( x ) + i 2 = h ( x ) + j 2 ( mod TableSize ) then: i 2 = j 2 ( mod TableSize ) ( i + j ) ( i - j ) = 0 ( mod TableSize ) TableSize is prime either ( i + j ) or ( i - j ) is divisible by TableSize Contradiction ! For any x , it has TableSize/2 distinct locations into which it can go. If at most TableSize/2 positions are taken, then an empty spot can always be found. 1/7

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

View Full Document
§4 Open Addressing Note: If the table size is a prime of the form 4 k + 3, then the quadratic probing f ( i ) = ± i 2 can probe the entire table. Note: If the table size is a prime of the form 4 k + 3, then the quadratic probing f ( i ) = ± i 2 can probe the entire table.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern