Skip to content

Instantly share code, notes, and snippets.

@robatron
Created February 27, 2016 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robatron/217b56c033a6e3031c30 to your computer and use it in GitHub Desktop.
Save robatron/217b56c033a6e3031c30 to your computer and use it in GitHub Desktop.
/**
* Represents a hash table implemented on top of an array where each bucket is
* also an array.
*/
class HashTable {
// Create a new hash table instantiated with the table size, the size of
// the the array
constructor(tableSize) {}
// Retreive a value of the key stored in the hash table. Return null if
// not found.
get(key) {};
// Place a key-value pair in the hash table
put(key, val) {};
// Remove the specified entry from the HashMap if found. Returns the value
// of the removed entry
remove(key) {};
}
@wjramos
Copy link

wjramos commented Feb 28, 2016

Would a get return null instead of undefined? I'd imagine null would be a valid value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment