+ 3
What is the logic to implement open addressing(linear probing)??
I have implemented C program of perfect hashing. But when the collision occurs then how can I solve it using open addressing (linear probing). Only we need to make a changes in else part of insert() function. So I need logic of open addressing. To put in else part of insert(). https://code.sololearn.com/cYG5j5pG2dWM/?ref=app
8 ответов
+ 3
Thank you so much all...but I solved my problem myself😊
Here is the solution.
https://code.sololearn.com/cq1A73qh8VWU/?ref=app
+ 3
Im using c not cpp
+ 3
And the link of program that I have provided above is working perfectly. That is the program of perfect hashing. I need logic of linear probing.
+ 3
Do you know the concept of linear probing or open addressing??
+ 3
👍
+ 2
I think you should add break statement after adding an element into.
Linear probing is a technic of add element if the current (hash result) location is already occupied then just add element in linearly next free empty space.
For ex :
If location are 1 to 10, if you want add 3, but 3,4 is are occupied then add in next free space that is 5.
But this technic may get difficulties in searching..
Hope it make sense and helps...