Skip to content

Instantly share code, notes, and snippets.

View evanchen7's full-sized avatar

Evan Chen evanchen7

View GitHub Profile
@evanchen7
evanchen7 / hashTable.js
Created July 28, 2017 01:06 — forked from alexhawkins/hashTable.js
A Simple Hash Table in JavaScript
/*HASH TABLE - a dictionary/hash map data structure for storing key/value pairs. Finding
an entry in a hash table takes O(1) constant time(same for 10 as 1 billion items). Whereas
finding an item via binary search takes time proportional to the logarithm of
the item in the list O(logn). Finding an item in a regular old list takes time proportional to
the length of the list O(n). Very slow. Hash Tables = very fast */
var makeHashTable = function(max) {
var storage = [],
hashTableMethods = {