-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
45 lines (41 loc) · 1.31 KB
/
Main.java
File metadata and controls
45 lines (41 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import javax.imageio.IIOException;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.*;
public class Main {
public static void main(String[] args) throws FileNotFoundException, IOException {
Trie x = new Trie();
BufferedReader br = new BufferedReader(new FileReader("C:\\Users\\cassi\\ATDP\\Porject-2\\count_1w.txt"));
String line;
int i = 0;
while ((line = br.readLine()) != null) {
String[] values = line.split("\t");
long fre = Long.parseLong(values[1]);
x.insertMain(values[0], fre);
i++;
if(i > 100000)
{
break;
}
}
Scanner y = new Scanner(System.in);
while (true) {
System.out.println("Put in a word: ");
String temp = y.next();
if (temp.equals("stop")) {
break;
} else {
PriorityQueue<Node> z = x.findStarter(temp);
if(z == null)
{
System.out.println("No words");
}
else {
x.sortAndPrint(z);
}
}
}
}
}