Lecture12 - Algorithms in Systems Engineering IE170 Lecture...

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

View Full Document Right Arrow Icon
Algorithms in Systems Engineering IE170 Lecture 12 Dr. Ted Ralphs
Background image of page 1

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

View Full DocumentRight Arrow Icon
IE170 Lecture 12 1 References for Today’s Lecture Required reading CLRS Chapter 11 References D.E. Knuth, The Art of Computer Programming, Volume 3: Sorting and Searching (Third Edition), 1998. R. Sedgewick, Algorithms in C++ (Third Edition), 1998.
Background image of page 2
IE170 Lecture 12 2 Open Addressing In open addressing , all the elements are stored directly in the hash table. If an address is already being used, then we systematically move to another address in a predetermined sequence until we find an empty slot. Hence, we can think of the hash function as producing not just a single address, but a sequence of addresses h ( x, 0) ,h ( x, 1) ,...,h ( x,M - 1) . Ideally, the sequence produced should include every address in the table. The effect is essentially the same as chaining except that we compute the pointers instead of storing them. The price we pay is that as the table fills up, the operations get more expensive. It is also much more difficult to delete items.
Background image of page 3

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

View Full DocumentRight Arrow Icon
IE170 Lecture 12 3 Linear Probing In linear probing , we simply try the addresses in sequence until an empty slot is found. In other words, if h 0 is an ordinary hash function, then the corresponding sequence for linear probing would be Items are inserted in the first empty slot with an address greater than or equal to the hashed address (wrapping around at the end of the table). To search , start at the hashed address and continue to search each succeeding address until encountering a match or an empty slot. Deleting is more difficult
Background image of page 4
4 Analysis of Linear Probing The average cost of linear probing depends on how the items cluster together in the table. A cluster is a contiguous group of occupied memory addresses. Consider a table with half the memory locations filled. Generalizing, we see that search time is approximately proportional to
Background image of page 5

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

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

This note was uploaded on 02/29/2008 for the course IE 170 taught by Professor Ralphs during the Spring '07 term at Lehigh University .

Page1 / 18

Lecture12 - Algorithms in Systems Engineering IE170 Lecture...

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

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