0% found this document useful (0 votes)
27 views1 page

Problem 1: Phone Book (Redo With Hashtable)

This document outlines two problems: 1. Modify an existing PhoneBook program to use a Hashtable instead of a Map to lookup phone numbers from a name, given input and output files. 2. Analyze the performance of 6 different data structures (ArrayList, LinkedList, Hashtable, HashMap, HashSet, TreeSet) for extracting unique words from a list of 10,000 words and timing each implementation.

Uploaded by

cocobunzz
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views1 page

Problem 1: Phone Book (Redo With Hashtable)

This document outlines two problems: 1. Modify an existing PhoneBook program to use a Hashtable instead of a Map to lookup phone numbers from a name, given input and output files. 2. Analyze the performance of 6 different data structures (ArrayList, LinkedList, Hashtable, HashMap, HashSet, TreeSet) for extracting unique words from a list of 10,000 words and timing each implementation.

Uploaded by

cocobunzz
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 1

Problem 1: Phone Book (Redo with Hashtable) The problem description and input/output spec are exactly as Problem

1 of Lab 12. We examined Map based (e.g., HashMap and TreeMap) solution last week (solution provided today). Well use Hashtable, another implementation of Map interface, this week. Modify PhoneBook.java to use Hashtable. Run in the following way: java PhoneBookDriver db.txt query.txt Problem 2: Unique Words (Performance Analysis) File input.txt contains 10,000 words. Not all of these words are unique. We will prepare a list (set) of unique words from this bank of words. We can choose a data structure from a toolbox of data structures to do it. Choices are not equivalent in terms of performance. Modify UniqueWords.java to use the following six data structures: A. List<String> 1. ArrayList<word: String> 2. LinkedList<word: String> B. Map<String, String> 3. Hashtable<word: String, word: String> 4. HashMap<word: String, null: String> C. Set<String> 5. HashSet<word: String> D. SortedSet<String> 6. TreeSet<word: String> Compare runtime for six implementations. Upload your solutions and the table of runtimes. Solution for the 3rd version (i.e., Hashtable) is provided. You have to explicitly invoke contains() method for data structures that support duplicate entries as we are looking for unique words.

You might also like