CS367 Homework 8
| |||||||||||||||||||||||||||||||||
AnnouncementsCheck here periodically.
| |||||||||||||||||||||||||||||||||
QuestionsHomework assignments must be done individually. Collaboration on homework assignments is not allowed. Question 1:The ten most common words in English, along with their hash codes according to Java's String.hashCode method, are:
Suppose these strings are inserted into a 14-bucket hash table in the order shown above. Each string's bucket is its hash code modulo 14. If collisions occur, each bucket is implemented as a singly-linked list, with new items added to the head 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. Question 2:A bank with many branches in multiple districts needs to be able to access accounts in order to record transactions (such as deposit or withdraw). It has been decided that hashtables will be used to store account information. Each individual branch will have its own hashtable and store only the accounts for its customers. Each account contains the following information:
The account numbers have the following properties:
The programmer implementing the hashtable for the bank is considering 4 different hash functions: hash2: hash on the first 5 digits of the account number hash3: hash on the last 5 digits of the account number hash4: hash on the balance Part A: Which of the hash functions above is the best for this situation? Briefly explain why. Part B: For each of the 3 remaining hash functions, briefly explain the problems/disadvantages with the hash function that make less suitable for this situation. Handing inPlease include your name at the top your file. Put your answers to the questions into one file named Homework8 with the appropriate file extension, e.g., Homework8.pdf (see File Format for acceptable file formats). Electronically submit your work to the Homework 8 Dropbox on Learn@UW. | |||||||||||||||||||||||||||||||||
Last Updated: 10/23/2015 © 2015 Beck Hasti & Charles Fischer |