Implement a Java program that counts word frequencies in a text file. Use a HashMap to store the data in the program – the words are the keys, and their frequencies are the values. The output of the program is the complete list of all the words and their frequencies in descending order of frequencies. Specifically, each line of output consists of a word, a tab, and the frequency. A sample input is “The Tragedy of Hamlet, Prince of Denmark”, in the file HAMLET.TXT. When processing the text, you should keep just the words, and discard all punctuation marks, digits, and so on. You also need to turn all upper case letters to lower cases.
You must sort the words by their frequencies. Let N be the length of the file. You are allowed to use only O(N) time for sorting. Do not sort the words alphabetically – it will take Ω(N log N) time. Consequently, if two words have the same frequency, you may print either word first.
You must deposit your program in the CS 310 folder under your Unix home directory before 12 PM (noon) on the due date. Late submission receives zero.