Project-3 (200 Pts) Computing Frequency & Prob. Of words Due Date: 3/12

Your complete project is not in a SINGLE xxxxxp3.java file, where xxxxx is the
first 5 characters of your last name and p3 is the project number.
It does not read input from System.in. i.e. command prompt.
Using package or any java utilities such as arraylist, LinkedList ,map, queue….i.e.
the whole code should be written by yourself as explained in class.
Given a *.txt document as input, write an efficient java program xxxxxp3.java to compute
frequency and probability of words in input using binary search tree(bst).
FYI:The output of this project is the input for next project to compute optimal biniary
search tree (obst) for words in any document.
Please write your Last name, First name and Student ID at the beginning of your java file
as well as at the beginning of the output. Your main method should be as follow:
public static void main(String args[]) throws exception{
xxxxxp3 obstinput = new xxxxxp3 ();
// xxxxx is the first 5 characters of your last name
System.out.print(“ntProgram to compute frequency and probability of words in
+ *.txt file.nPrepared by Last: , First:
+ ntStudent ID: Date: “);
// read input and build bst tree
obstinput.buildbstree();
// Print created bst in ascending order in a user friendly manner.
obstinput.printbstree();
}// end main method
To compile at the command prompt: javac xxxxxp3.java
To execute at the command prompt: java xxxxxp3 < any data file

For the following input

public and static void main string and new is the first chars and of your last name void try
scanner public static and void main string new is the first void chars of your void last
name try scanner public and static void main string new is the
The output should be
Input sorted by words, Total number of words = 48
Word Freq Prob
1- and 5 0.1042
2- chars 2 0.0417
3- first 2 0.0417
4- is 3 0.0625
5- last 2 0.0417
6- main 3 0.0625
7- name 2 0.0417

CSUN Department of Computer Science
COMP 282 Advanced Data Structures Spring 2020

Project-3 (200 Pts) Computing Frequency & Prob. Of words Due Date: 3/12

PLEASE BRING YOUR QUESTIONS TO CLASS TO DISCUSS.

8- new 3 0.0625
9- of 2 0.0417
10- public 3 0.0625
11- scanner 2 0.0417
12- static 3 0.0625
13- string 3 0.0625
14- the 3 0.0625
15- try 2 0.0417
16- void 6 0.1250
17- your 2 0.0417

Leave a Reply

Your email address will not be published. Required fields are marked *