Problem 1: Phone Book (Redo With Hashtable)
Problem 1: Phone Book (Redo With Hashtable)
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.