1.

What do you mean by collisions in a hash table? Explain the ways to avoid it.

Answer»

Hash table collisions are typically caused when two keys have the same index. Collisions, thus, result in a problem because two ELEMENTS cannot share the same slot in an array. The following methods can be used to avoid such hash collisions:  

  • Separate chaining TECHNIQUE: This METHOD involves STORING numerous items hashing to a common slot using the data structure.  
  • Open addressing technique: This technique locates unfilled slots and stores the item in the first unfilled slot it finds.


Discussion

No Comment Found