How to insert a record in a hash table?

Inserting a new record (key, value)is a two-step procedure: we extract the three last digits of the key, hash = key % 1000, and then insert the key and its value into the list located at table[hash]. hash = key % 1000 table[hash].AddFirst(key, value) This is a constant time operation. A lookup is implemented by value = table[key%1000].Find(key)
For More Information Please Refer:


You May Also Like to Read: