Consider the following URLs http://files.seds.org/pub/software/text/weather.txt http://files.seds.org/pub/software/text/robotic.txt Scan each file of above URLs and count the frequency of each word in these files separately. Once you calculate the frequencies then store it in another text file line by line as follows. 166 a 25 and 11 as 3 command Build a binary search tree for each URL where each node of binary search tree consists of a word and corresponding frequency calculated above. The node of a tree is shown below. Assume you program is not case sensitive
@UnkleRhaukus @wio @malihe @nuz93
Show some code so it looks like you tried yourself before just asking someone else to do your homework.
package frequency; import java.util.*; import java.io.*; public class Frequency { public static void main(String[] args) { String fileName = "C:\\Users\\studentlab2\\Desktop\\weather.txt"; String line=null; try { FileReader fileReader = new FileReader(fileName); BufferedReader. BufferedReader bufferedReader = new BufferedReader(fileReader); while((line = bufferedReader.readLine()) != null) { String[] var = line.split(" "); for (int i=0;i<var.length;i++) { System.out.println(var[i]); } } bufferedReader.close(); } catch(FileNotFoundException ex) { System.out.println( "Unable to open file '" + fileName + "'"); } catch(IOException ex) { System.out.println( "Error reading file '" + fileName + "'"); }
@seandisanti
Join our real-time social learning platform and learn together with your friends!