Map Hash Tables and Dictionaries_Part_7

Map Hash Tables and Dictionaries_Part_7 - Performance of...

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

View Full Document Right Arrow Icon
Last Updated: 06/02/12 10:23 PM CSE 2011 Prof. J. Elder - 31 - Performance of Hashing In the worst case, searches, insertions and removals on a hash table take O ( n ) time The worst case occurs when all the keys inserted into the map collide The load factor λ = n / N affects the performance of a hash table For separate chaining, performance is typically good for λ < 0.9. For open addressing , performance is typically good for λ < 0.5. java.util.HashMap maintains λ < 0.75 Separate chaining is typically as fast or faster than open addressing.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Last Updated: 06/02/12 10:23 PM CSE 2011 Prof. J. Elder - 32 - Rehashing When the load factor λ exceeds threshold, the table must be rehashed . A larger table is allocated (typically at least double the size). A new hash function is defined. All existing entries are copied to this new table using the new hash function.
Background image of page 2
06/02/12 10:23 PM CSE 2011 Prof. J. Elder - 33 - DICTIONARIES
Background image of page 3

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

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

This note was uploaded on 02/14/2012 for the course CSE 2011Z taught by Professor Elder during the Fall '11 term at York University.

Page1 / 5

Map Hash Tables and Dictionaries_Part_7 - Performance of...

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

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