Skip to content

Commit

Permalink
fix: hashtable with open addressing with linear probing
Browse files Browse the repository at this point in the history
  • Loading branch information
tolstenko committed Feb 27, 2024
1 parent eab2d47 commit 985bc29
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/algorithms/06-hashtables/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ int main() {
Open addressing is a method of collision resolution in hash tables. In this approach, each cell is not a pointer to the linked list of contents of that bucket, but instead contains a single key-value pair. In linear probing, when a collision occurs, the next cell is checked. If it is occupied, the next cell is checked, and so on, until an empty cell is found.
![img_5.png](img_5.png) [source](https://www.slideshare.net/rajshreemuthiah/linear-probing)
The main advantage of open addressing is cache-friendliness. The main disadvantage is that it is more complex to implement, and it is not as efficient as linked lists when the table is too full. That's why we have to resize the table earlier, usually at 50% full, but at least 70% full.
![img_4.png](img_4.png) [source](https://en.wikipedia.org/wiki/File:Hash_table_average_insertion_time.png)
Expand Down
Binary file added docs/algorithms/06-hashtables/img_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 985bc29

Please sign in to comment.