Question: write a program named WordCount.java to perform the tasks described below. 1) The program should read a text file and build a List of words

write a program named WordCount.java to perform the tasks described below.

1) The program should read a text file and build a List of words in the file. (This first part of your program is not timed.)

(The next steps in your program should be timed. Repeat the next steps 10 times and capture the 'best'

time.)

2) Place the words from the word List into a TreeMap of frequency counts for the words.

3) Your program should then extract the top 'N' most frequent words and the frequency counts for those words.

Next, repeat the above process using a HashMap instead of a TreeMap.

4)Your program must display the total number of words in the file, the top 'N' words and the count for each of those words, and the elapsed times for the TreeMap and HashMap implementations.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!