COMPSCI 61B Lecture Notes - Lecture 21: Hash Table, Trie, Dissociation Constant

34 views18 pages
19 Mar 2019
School
Professor

Document Summary

We"ve seen 2 fairly general implementations of sets and maps. Hash table: requires that keys can be hashed. Search tree: requires that keys can be compared. Data indexed array: requires that keys are small. 2d range searching: how many objects are in the highlighted rectangle. Suppose the set is stored as a hash table, where the hash code of each body is given below. The bucket that each object is effectively random. The problem with hash tables is that the bucket # of an item is random. One fix is to ensure that the bucket #s depend only on position. Example on right for 4x4 grid of such buckets. Nice improvement, no need to look at points in bucket. Simplest idea: partition space into uniform rectangular buckets ( bins ) Typical implementation would have the container itself compute a bucket number. This is sometimes called spatial hashing , though it is unofficial.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents