Thursday 30 July 2020

Linear Probing - Coursera Algorithms

Linear probing is used to resolve collisions in hashing. It takes less space and has better cache performance.

An array of size M > number of elements N is used such that:

1. Hash - map key to i between 0 and M-1.
2. Insert - at table index i, if not free - try i+1, i+2 etc
3. Search - search table index i, if occupied and no match - try i+1, i+2 etc

Following is the implementation :

No comments:

Post a Comment