Review - Hashing

Review - Hashing - a. If a word hashes to a location with...

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

View Full Document Right Arrow Icon
1 Review #3 - Hashing 1. Given input {4371, 1323, 6173, 4199, 4344, 9679, 1989} and a hash function h(x) = x (mod 10), show the resulting: a. Separate chaining hash table. b. Open addressing hash table using linear probing. c. Open addressing hash table using quadratic probing. d. Open addressing hash table with second hash function h 2 (x) = 7 – (x mod 7).
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 2. If memory is limited and the entire dictionary cannot be stored in a hash table, we can still get an efficient algorithm that almost always works. We declare an array Table of bits (initialized to zeros) from 0 to tableSize-1. As we read in a word, we set Table [ Hash(Word) ] = 1. Which of the following is true?
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: a. If a word hashes to a location with value 0, the word is not in the dictionary. b. If a word hashes to a location with value 1, then the word is in the dictionary. c. What is the probability of an error in this algorithm? d. A typical document might have about three actual misspellings per page of 500 words. Is this algorithm usable? 3 3. Show the result of inserting the keys 10111101, 00000010, 10011011, 10111110, 01111111, 01010001, 10010110, 00001011, 11001111, 10011110, 11011011, 00101011, 01100001, 11110000, 01101111 into an initially empty extendible hashing data structure with M=4....
View Full Document

Page1 / 3

Review - Hashing - a. If a word hashes to a location with...

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

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