Starting from:
$35

$29

Homework 4 Solution

Problem 1. (Array-based Symbol Table) Develop a symbol-table implementation ArrayST that uses an (unordered) array as the underlying data structure to implement the basic symbol-table API (p. 363).


















Problem 2. (Frequency Counter ) Modify FrequencyCounter from the text to use ArrayST from above and also to print all of the values having the highest frequency of occurrence, instead of just one.












Problem 3. (Average GPA) Write an ArrayST client called AvgGPA that creates a symbol table mapping letter grades to numerical scores, as in the table below, then reads from standard input a list of letter grades and computes and prints the average GPA (the average of the numbers corresponding to the grades).

A+AA-B+ 4.33 4.0 3.67 3.33

B

3.0

B-

2.67

C+

2.33

C

2.0

C-

1.67

D

1.0

F

0.0
CS146    Homework 4











Problem 4. (Spell Checker) Write a SeparateChainingHastST client called Spell that takes a command-line argument specifying the name of the le containing common misspellings (a line-oriented le with each comma-separated line containing a misspelled word and the correct spelling), then reads text from standard input and prints out the misspelled words in the text along with the line numbers where they occurred and their correct spellings.
















Problem 5. (Tree Traversal) Implement the methods preOrder(), inOrder(), postOrder(), and levelOrder() in TreeTraversal that return the an iterable object containing nodes of a binary tree traversed in pre-, in-, post-, and level-order, respectively.

More products