Linear Probing:-
Here we find the index from hash function. If that index is already occupied than we go to the next index available vacant index sequentially. While searching for the next available vacant index, if we come across any cell storing the same value which we are trying to store, than we stop our operation right there. This is all we need to be carefull when doing insertion or search operation using linear probing.
Deletion is a special case here. Suppose we delete some value from a specific index, we need to perform one more operation in this case where we continue parsing the remaining table from the deletion point and if we come across any value whose hashfunction value is equal to or lesser than hash value of to be deleted value, than in that case we just move this new value with the value which is being deleted.
Here we find the index from hash function. If that index is already occupied than we go to the next index available vacant index sequentially. While searching for the next available vacant index, if we come across any cell storing the same value which we are trying to store, than we stop our operation right there. This is all we need to be carefull when doing insertion or search operation using linear probing.
Deletion is a special case here. Suppose we delete some value from a specific index, we need to perform one more operation in this case where we continue parsing the remaining table from the deletion point and if we come across any value whose hashfunction value is equal to or lesser than hash value of to be deleted value, than in that case we just move this new value with the value which is being deleted.
No comments:
Post a Comment