Question: THE LANGUAGE OF THE COURSE IS PYTHON SO PLEASE USING PYTHON 1 Hash Tables The ten most common words in English, along with their hash
THE LANGUAGE OF THE COURSE IS PYTHON SO PLEASE USING PYTHON
1 Hash Tables
The ten most common words in English, along with their hash codes accordingly are as in Table 1.
| Order | Word | Hash Code |
| 1 | the | 114801 |
| 2 | of | 3543 |
| 3 | to | 3707 |
| 4 | and | 96727 |
| 5 | a | 97 |
| 6 | in | 3365 |
| 7 | is | 3370 |
| 8 | it | 3371 |
| 9 | you | 119839 |
| 10 | that | 3558823 |
Table 1: The ten most common words in English, along with their hash codes.
Task-1: Suppose these strings are inserted into a 14-bucket hash table in the order shown above. Each strings bucket is its hash code modulo 14. If collisions occur, each bucket is implemented as a simple unsorted map, with new items added to the end of the list. Show the contents of all buckets after these strings are inserted. Give each bucket as a bucket number followed by a list of strings, with the head of the list at the left.
Task-2: Suppose these strings are inserted into a 14-bucket hash table in the order shown. Each strings initial bucket is its hash code modulo 14. If collisions occur, use linear probing with a step size of 1. Show the contents of all buckets after these strings are inserted. Give each bucket as a bucket number followed by the string in that bucket, if any.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
