Question: Hallo! I need help please about java language! a) Use the TreeSet class from the java library ,https://docs.oracle.com/javase/6/docs/api/java/util/TreeSet.html in a program that loads all words
Hallo!
I need help please about java language!
a) Use the TreeSet class from the java library ,https://docs.oracle.com/javase/6/docs/api/java/util/TreeSet.html
in a program that loads all words from a text file to an TreeSet. (Use any file you want but it should contain my 500 words). Then, using the tree's iterator, print all the words to System.out or to a file. Question: In which order are the words printed? Why? In order to know how many unique words are found in a file, but also the number of occurrence of each word, you should develop a special tree data structure. Call the TreeSetCounter class. A node in such a tree consists of a word and a counter. The following methods are to be implemented: addword add words to enter if words do not already exist. If the word is found, the counter must be updated makeEmpty () - clear the tree getMaxFrek () - return the word that has occurred the most number of times. How can you do it most effectively? iterator () - return an iterator to the tree. It should be used to print the tree in alphabetical order. Use as a starting point any balanced tree implementation. Write about the program from point a so that you read a file and print both the words and the number of occurrences of each word.
Thanks!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
