CS 0445 Lecture Notes - Lecture 30: Linear Probing, Prime Number

64 views1 pages
School
Course
Professor

Document Summary

Hash code via . hashcode() - > address -> store somehwhere in hashtable. Address is dependent on the number of elements in the array. Ex: hashcodes remaineder by % 11 for even spread into table array locations = 10, 8, 3, 0, 0, 2. Hashtable look up is a o(1) operation. Note: collision at values of hashcode 22 and 11. Solve via linear probing (adding to next available space) which increases load factor. An instance of hashmap has two parameters that affect its performance: initial capacity and load factor. The capacity is the number of buckets in the hash table, and the initial capacity is simply the capacity at the time the hash table is created. The load factor is a measure of how full the hash table is allowed to get before its capacity is automatically increased. Load factor of 0. 5 makes operations o(n)

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