Using tuples in a linked list in python -
Using tuples in a linked list in python -
my teacher wants recreate dict class in python using tuples , linkedlists (for collisions). 1 of methods used homecoming value given key. know how in tuple ( find key @ location[0] , homecoming location[1]) have no thought how in case of collision. suggestions? if more info needed please allow me know
it sounds have sort of hash shortlist of possibilities, so, hash key small-ish number, e.g. 0-256 (as example, might hash 63). can go straight info @ index 63. because might have more 1 item hashes 63, entry 63 contain list of (key,value) pairs, have search 1 1 - effectively, you've reduced search area 255/256th of total list. optionally, when collisions particular key exceeds threshold, repeat process - mydict[63][92], 1 time again reducing problem size same factor. repeat indefinitely.
python linked-list
Comments
Post a Comment