CSC148H1 Lecture Notes - Lecture 30: Hash Table, Double Hashing, Linear Probing

79 views4 pages
School
Course
Professor
CSC148: Lecture 30: Hashing
References: Code seen in the picture can be found on the CSC148 website
http://www.teach.cs.toronto.edu/~csc148h/winter
Lists and Linear Search and Ordered Lists and Binary Search
Data Structure
search()
insert()
delete()
List
O(n)
O(n)
O(n)
Ordered List
O(lg n)
O(lg n)
O(lg n)
Complexity Comparisons
- Comparison of function growth:
- How does dictionary offer constant time search?
o By a technique called hashing
Why Hash
- Lists are contiguous (adjacent) sequences of references to objects -> so access to a list
position is fast (just arithmetic)
Unlock document

This preview shows page 1 of the document.
Unlock all 4 pages and 3 million more documents.

Already have an account? Log in
katrinasavvy and 38715 others unlocked
CSC148H1 Full Course Notes
1
CSC148H1 Full Course Notes
Verified Note
1 document

Document Summary

References: code seen in the picture can be found on the csc148 website http://www. teach. cs. toronto. edu/~csc148h/winter. Lists and linear search and ordered lists and binary search. How does dictionary offer constant time search: by a technique called hashing. Lists are contiguous (adjacent) sequences of references to objects -> so access to a list position is fast (just arithmetic) Once you hashed an object to a number, you can easily use part of that number as an index into a list to store the object or something related to that object. If the list is of length n, you might store information about object o at index hash(o) % n. What"s the time complexity of: finding the string ada" in this list, what if you knew the index of ada", but how do you know the index of ada" in the list. Index number = sum ascii codes, mod, size of array: find ada, 262 mod 11 = 9, mydata = array(9)

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