Skip to content

Latest commit

 

History

History
23 lines (14 loc) · 623 Bytes

File metadata and controls

23 lines (14 loc) · 623 Bytes

Hashtables

data structure hat store data as key value pairs

Challenge

to build hashtable class and define add, get and contains methods for it

Approach & Efficiency

hash: time O(n), space O(1) add: time O(1), space O(1) get: time O(1) space O(1) contains: time O(1) space O(1)

API

hash: method returns Index in the collection for that key

add: method that hash the key, and add the key and value pair to the table, handling collisions as needed.

get: method returns Value associated with that key in the table.

contains: method returns Boolean, indicating if the key exists in the table already.