Map Hash Tables and Dictionaries_Part_3

Map Hash Tables and Dictionaries_Part_3 - Hash Tables A...

Info iconThis preview shows pages 1–5. 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 - 11 - Hash Tables A hash table is a data structure that can be used to make map operations faster. While worst-case is still O(n), average case is typically O(1).
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 - 12 - Applications of Hash Tables databases compilers browser caches
Background image of page 2
Last Updated: 06/02/12 10:23 PM CSE 2011 Prof. J. Elder - 13 - Hash Functions and Hash Tables A hash function h maps keys of a given type to integers in a fixed interval [0, N ± 1] Example: h ( x ) = x mod N is a hash function for integer keys The integer h ( x ) is called the hash value of key x A hash table for a given key type consists of Hash function h Array (called table) of size N When implementing a map with a hash table, the goal is to store item ( k , o ) at index i = h ( k )
Background image of page 3

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
Background image of page 4
Background image of page 5
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_3 - Hash Tables A...

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

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