1 1 vote You are designing a Hash Table using Chaining (also known as "Open Hashing") to handle collisions. In this system, multiple keys that hash to the same index are stored in a Singly Linked List at that specific bucket.Suppose your hash function is $h(k)=k(\bmod 7)$. You insert the following keys in this order$: 14, 21, 28,$ and $35.$ After these insertions, what is the length of the longest linked list in the table? Programming in Python goclasses python-&-dsa goclasses-da-dpp goclasses-da-dpp-day-83 goclasses-python-&-dsa-practice-questions numerical-answers + – GO Classes 212 views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
0 0 votes The hash function provided is $h(k)=k(\bmod 7)$. This means we divide the key by $7$ and look at the remainder to determine which "bucket" the key belongs to.Key $\mathbf{14:} ~14 \div 7=2$ with remainder $\mathbf{0}$. $($Bucket $0)$ Key $\mathbf{21:} ~ 21 \div 7=3$ with remainder $\mathbf{0}$. $($Bucket $0)$ Key $\mathbf{28:} ~ 28 \div 7=4$ with remainder $\mathbf{0}$. $($Bucket $0)$ Key $\mathbf{35:} ~ 35 \div 7=5$ with remainder $\mathbf{0}$. $($Bucket $0)$Because all four keys produce a remainder of $0$, they are all stored in the same bucket. In a chaining system, they form a linked list at index $0$ with a length of $\mathbf{4}$. GO Classes answered Jan 8 GO Classes comment Share Follow 0 reply Please log in or register to add a comment.