Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4 Sort Words ( 2 0 % ) Implement a program in Java that receives as arguments an input directory and an output directory and
Sort Words
Implement a program in Java that receives as arguments an input directory and an output directory and that sorts the words read from each file by frequency in descending order and writes the sorted words and their frequencies in a corresponding file in the output directory.
The output files must follow the same folder structure as the input files. For example, if the program sorts the words found in the input file stored at CountedDatasetfolderdocumenttxt it must store the sorted words in the file at SortedDatasetfolderdocumenttxt where CountedDataset was the input directory and SortedDataset was the output directory. This program will use the output of the previous program as input.
When the program finished counting the words from an input file it needs to write in the corresponding output file on each line the word and the number of occurrences, separated by a space, similarly to the previous program.
For example, for the following input file:
filed
in
a different
way
The
year
of
release
date
is
longer
part
the
directory
path
based
number
which
identical
to
filename
The program needs to create the corresponding output file that contains:
the
of
is
The
path
to
filename
filed
in
a different way
year release date longer part directory based number which identical
Evaluate your program on the datasets and measure inside the program the number of words read from the input and the amount of wall time it took to sort the words in all files. Plot a diagram showing how the total number of words from the datasets influences the throughput of your program, measured in wordssecond total number of words in the datasets divided by total amount of time to sort the dataset Answer the following questions:
What data structures did you use to implement the program and why?
What algorithm did you use to sort the data and why?
Is your program computeintensive, memoryintensive or IOintensive and why?
Why would the total number of words in a dataset influence the performance of your program on the virtual machine?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started