Hash Function and Bucket Placement
Implement _hash(key) (sum of character codes, modulo table size) and put(key, value) for a basic HashTable with no collision handling. put should print "Inserted {key} at index {i}" normally, or "COLLISION: {key} overwrote {old_key} at index {i}" if the bucket already holds a different key (re-inserting the same key is not a collision).
Read the table size, then the number of key-value pairs, then that many "key value" pairs, calling put for each in order.
main.py
Loading editor…
Console
Run your code to see output here.