hashtable - I am creating a Hash Table that uses nodes to chain. What is a collision? -


i can't seem answer understand. collision when have hash table uses linked nodes?

is collision +1 every index must pass index needed node adding?

i know collisions unavoidable, have learned through research haven't been able figure out constitutes collision when dealing hash table has linked nodes.

my program after finding proper place in array (array of pointers nodes), sticks new node @ front. each element points @ node points @ node, have multiple linked lists. so, collision count include first node of element new node belongs because stick @ front, or include every single node in linked list element.

for example, if name "smith" goes element [5], has 5 other nodes linked together, , add front, how decide collision count is?

thanks help!

a collision when 2 distinct entries produces same output through hash function.

say (poorly designed) hash function h consists in adding digits of number:

5312 -> 5 + 3 + 1 + 2 = 11
1220 -> 1 + 2 + 2 + 0 = 5

so h(5312) = 11 , h(1220) = 5

h has lot of collisions (this why should not use it):

h(4412) = 4 + 4 + 1 + 2 = 11
h(9200) = 9 + 2 + 0 + 0 = 11
etc...


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -