http://nameless.cis.udel.edu/class_wiki/index.php?title=CISC220_F2014_Lab8&feed=atom&action=historyCISC220 F2014 Lab8 - Revision history2022-05-18T19:44:20ZRevision history for this page on the wikiMediaWiki 1.28.0http://nameless.cis.udel.edu/class_wiki/index.php?title=CISC220_F2014_Lab8&diff=31&oldid=prevCer: Created page with "==Lab #8== ===1. Written problems=== Suppose you want to ''hash'' words into a hash table of size ''m''. Let ''v_i'' be the English alphabet place value of the ''i''th lett..."2017-01-18T15:29:51Z<p>Created page with "==Lab #8== ===1. Written problems=== Suppose you want to ''hash'' words into a hash table of size ''m''. Let ''v_i'' be the English alphabet place value of the ''i''th lett..."</p>
<p><b>New page</b></p><div>==Lab #8==<br />
<br />
===1. Written problems===<br />
<br />
Suppose you want to ''hash'' words into a hash table of size ''m''. Let ''v_i'' be the English alphabet place value of the ''i''th letter in a q-letter word W, where the value of 'a' = 0, 'b' = 1, ..., 'z' = 25. One possible hash function is <br />
<br />
h(W) = [v_0 + v_1 + ... + v_(q-1)] mod m<br />
<br />
For example, if m = 11 and W = "abc", then h("abc") = [0 + 1 + 2] mod 11 = 3<br />
<br />
Assume m = 11 and you have the following list of words, in order:<br />
<br />
# dog<br />
# duck<br />
# cow<br />
# mouse<br />
# horse<br />
# sheep<br />
# goat<br />
# chicken<br />
# pig<br />
<br />
Please answer the following questions about the hash function, table, and list of words above. Feel free to write a short program to ensure that your calculations are correct. <br />
<br />
* '''(2 points)''' What are the "home positions" of every word? That is, what indices do they hash to before collisions are resolved? Either show your work or include your program code in the PDF.<br />
* '''(1 point)''' Show the final hash table if the words are inserted in the order above using ''separate chaining'' for collision resolution. Each chain should be an unordered, singly-linked list with the newest item being inserted at the head of the list.<br />
* '''(1 point)''' Show the final hash table if the words are inserted in the order above using ''linear probing'' with a step size of 1. What is the total number of probes beyond the home position for each word?<br />
* '''(1 point)''' Suppose the table is ''rehashed'' during linear probing when the load factor exceeds 0.5. Let the new table size be 23, the smallest prime number greater than 2m. Show the new hash table both right after rehashing AND after all the words have been inserted.<br />
<br />
===2. Submission===<br />
<br />
* Make a '''PDF file''' <Your Name>_Lab8_README.pdf with your answers to the written exercises<br />
* No need to compress or archive the PDF, since that's all you're turning in.<br />
* Submit it in Sakai by ''midnight at the end of Thursday, November 20''</div>Cer