Due Date: Wednesday of week 15

The following guidelines are expected for all homework submissions:

Problems for Assignment #5

Learning Outcomes: 1) implementing the tree traversals; 2) implementing a priority queue data structure using a heap data structure; 3) implementing a hash table that uses linear probing; 4) writing your own hashing method

This problem set has two problems from chapter 11, one problem from chapter 9, and one problem from chapter 12. You will be working with tree traversals, heaps, and hashes for this assignment. Your task is to complete the following problems using the programs specified in each one. As always, when you are finished and ready to submit your work, do so in your repo. MAKE SURE YOUR CODE MODULES ALL COMPILE FROM THE COMMAND LINE! Here are the problems:

  1. [This is a review problem to help you get ready for learning about graphs.] Write a method that does an in–order traversal of a tree. It should display all the items in the proper order. Remember that in–order means you visit the left sub–tree, then the current node, then the right sub–tree.
  2. Implement the PriorityQ class in the PriorityQ.java program [Listing 4.6] using a heap instead of an array. You should be able to use the Heap class in the heap.java program [Listing 12.1] without modification. Make it a descending queue [largest item is removed].
  3. Implement a linear probe hash table that stores strings. You'll need a hash function that converts a string to an index number; see the section Hashing Strings in chapter 11. Assume the strings will be lowercase words, so 26 characters will suffice.
  4. Write a hash function to implement a digit-folding approach in the hash function [as described in the Hash Functions section of chapter 11]. Your program should work for any array size and any key length. Use linear probing. Accessing a group of digits in a number may be easier than you think. Does it matter if the array size is not a multiple of 10?