SlideServe
Menu
Préférences
© SlideServe · v2026

Hash Tables

vida avatar
6 diapositives · 278 Views · Aug 01, 2014

Hash Tables. ADT Data Dictionary, with two operations Insert an item, Search for (and retrieve) an item How should we implement a data dictionary? Maintain a sorted array; use binary search Use sophisticated trees (later in curriculum) Use an array as a “hash table”.

Hash Tables - slide 1
01 / 6Hash Tables
1 / 17

Télécharger la présentation

Hash Tables
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Hash Tables • ADT Data Dictionary, with two operations • Insert an item, • Search for (and retrieve) an item • How should we implement a data dictionary? • Maintain a sorted array; use binary search • Use sophisticated trees (later in curriculum) • Use an array as a “hash table”

  2. Hash Table Implementation • Maintain an array of the data to be stored in the data dictionary • Need one (or maybe two) hash functions to map the “data” to an index in the array • Need a “collision policy” to resolve conflicts when multiple data hash (map) to the same index • Insert, Search follow same probe sequence

  3. Example Hash Table • Data will be strings • Array will be size 13 • h1(char *) = sum of ASCII values of characters in the string mod table size (13). • Collision policy – linear probing • When collision occurs add 1 mod table size to the location of the collision and continue to do that until an empty location is found

  4. Hash “Facts” • Two “main” kinds of hash tables, called open addressing, and chained hashing • Hash tables are very efficient IF table is less than 50% full • Linear probing is NOT a good collision policy, BUT, its easy to implement and works well when table is less than 50% full • If you’re interested look into double hashing

  5. Hash “Facts” • Two “main” kinds of hash tables, called open addressing, and chained hashing • Hash tables are very efficient IF table is less than 50% full • Linear probing is NOT a good collision policy, BUT, its easy to implement and works well when table is less than 50% full • If you’re interested look into double hashing

  6. Hash Table Effectiveness From Data Structure Techniques, p. 154 Thomas A. Standish, 1980