Hash Table
An associative array, that can map keys
(strings and numbers) to values in O(1).
- Source:
Example
var hash = require('path-to-algorithms/src/data-structures'+
'/hash-table');
var hashTable = new hash.Hashtable();
hashTable.put(10, 'value');
hashTable.put('key', 10);
console.log(hashTable.get(10)); // 'value'
console.log(hashTable.get('key')); // 10
hashTable.remove(10);
hashTable.remove('key');
console.log(hashTable.get(10)); // undefined
console.log(hashTable.get('key')); // undefined