CSCE 434 Lecture 25

From Notes
Jump to navigation Jump to search

« previous | Monday, October 21, 2013 | next »

Lecture Slides

Symbol Table

Requirements:

  • fast access (esp. search)
  • compactness

Implementations:

  • Unordered List (slow search)
  • Ordered List (slow insertion)
  • Binary Tree ( everything)
  • Hash Table ( everything)

Hash Table

Size should be prime

Hashing function should

  • depend only on
  • be cheap to compute
  • be uniform (each output is equally likely)
  • randomize order (similar inputs do not map to similar values)

Collisions: Inevitable unless input is known in advance. (all ops are modulo ).

  • Add the hash: , , , ...
  • Secondary Hash: , , , ...