{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture12

# Lecture12 - Algorithms in Systems Engineering IE170 Lecture...

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

Algorithms in Systems Engineering IE170 Lecture 12 Dr. Ted Ralphs

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

View Full Document
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.
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.

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

View Full Document
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
IE170 Lecture 12 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 the sum of squares of the lengths of the clusters.

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

View Full Document
IE170 Lecture 12 5 Further Analysis of Linear Probing The average cost for a
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 18

Lecture12 - Algorithms in Systems Engineering IE170 Lecture...

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

View Full Document
Ask a homework question - tutors are online