More ¡on ¡collec)ons ¡and ¡sor)ng ¡
CSCI ¡136: ¡Fundamentals ¡of ¡Computer ¡Science ¡II ¡ ¡• ¡ ¡Keith ¡Vertanen ¡
More on collec)ons and sor)ng CSCI 136: Fundamentals of - - PowerPoint PPT Presentation
More on collec)ons and sor)ng CSCI 136: Fundamentals of Computer Science II Keith Vertanen Overview Java Collec/ons List (last term), e.g.
CSCI ¡136: ¡Fundamentals ¡of ¡Computer ¡Science ¡II ¡ ¡• ¡ ¡Keith ¡Vertanen ¡
2 ¡
3 ¡
private ¡class ¡Pair ¡ { ¡ ¡ ¡ ¡ ¡String ¡key; ¡ ¡ ¡ ¡ ¡String ¡value; ¡ ¡ ¡ ¡ ¡ ¡public ¡Pair(String ¡key, ¡String ¡value) ¡ ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡this.key ¡= ¡key; ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡this.value ¡= ¡value; ¡ ¡ ¡ ¡ ¡} ¡ } ¡
4 ¡
ArrayList<Pair> ¡pairs ¡= ¡new ¡ArrayList<Pair>(); ¡ ¡ public ¡void ¡put(String ¡key, ¡String ¡value) ¡ { ¡ ¡ ¡ ¡ ¡for ¡(Pair ¡pair ¡: ¡pairs) ¡ ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡if ¡(pair.key.equals(key)) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡pair.value ¡= ¡value; ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡return; ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡} ¡ ¡ ¡ ¡ ¡} ¡ ¡ ¡ ¡ ¡pairs.add(new ¡Pair(key, ¡value)); ¡ } ¡ ¡ public ¡String ¡get(String ¡key) ¡ { ¡ ¡ ¡ ¡ ¡for ¡(Pair ¡pair ¡: ¡pairs) ¡ ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡if ¡(pair.key.equals(key)) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡return ¡pair.value; ¡ ¡ ¡ ¡ ¡} ¡ ¡ ¡ ¡ ¡return ¡null; ¡ } ¡
5 ¡
20090821,MSFT ¡23.93,24.42,23.77,24.41,690189 ¡ 20090824,MSFT ¡24.37,24.7326,24.28,24.64,541808 ¡ 20090825,MSFT ¡24.6,24.82,24.46,24.64,439802 ¡ 20090826,MSFT ¡24.56,24.75,24.42,24.55,410790 ¡ 20090827,MSFT ¡24.42,24.78,24.3,24.69,454956 ¡ 20090828,MSFT ¡25.05,25.49,24.61,24.68,558079 ¡ 20090831,MSFT ¡24.56,24.85,24.29,24.65,495971 ¡
6 ¡
public ¡static ¡void ¡main(String ¡[] ¡args) ¡ { ¡ ¡ ¡ ¡ ¡StringToStringDumb ¡map ¡= ¡new ¡StringToStringDumb(); ¡ ¡ ¡ ¡ ¡ ¡// ¡Time ¡how ¡long ¡it ¡takes ¡to ¡load ¡data ¡into ¡the ¡map ¡ ¡ ¡ ¡ ¡Stats ¡timer1 ¡= ¡new ¡Stats(); ¡ ¡ ¡ ¡ ¡while ¡(!StdIn.isEmpty()) ¡ ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡String ¡key ¡ ¡ ¡= ¡StdIn.readString(); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡String ¡value ¡= ¡StdIn.readString(); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡map.put(key, ¡value); ¡ ¡ ¡ ¡ ¡} ¡ ¡ ¡ ¡ ¡System.out.println("Loading ¡data:\n" ¡+ ¡timer1); ¡ ¡ ¡ ¡ ¡ ¡// ¡Time ¡how ¡long ¡it ¡takes ¡to ¡look ¡something ¡up ¡10K ¡times ¡ ¡ ¡ ¡ ¡Stats ¡timer2 ¡= ¡new ¡Stats(); ¡ ¡ ¡ ¡ ¡for ¡(int ¡i ¡= ¡0; ¡i ¡< ¡10000; ¡i++) ¡ ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡String ¡value ¡= ¡map.get("20090827,JCP"); ¡ ¡ ¡ ¡ ¡} ¡ ¡ ¡ ¡ ¡System.out.println("Using ¡map:\n" ¡+ ¡timer2); ¡ } ¡ % ¡java ¡StockDataDumb ¡< ¡sp500_2009.txt ¡ ¡ Loading ¡data: ¡ elapsed ¡(s) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡: ¡63.0 ¡ heap ¡memory ¡used ¡(KB) ¡: ¡39571 ¡ ¡ Using ¡map: ¡ elapsed ¡(s) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡: ¡10.517 ¡ heap ¡memory ¡used ¡(KB) ¡: ¡39571 ¡
7 ¡
8 ¡
private ¡int ¡hash(String ¡str) ¡ { ¡ ¡ ¡ ¡ ¡int ¡result ¡= ¡0; ¡ ¡ ¡ ¡ ¡for ¡(int ¡i ¡= ¡0; ¡i ¡< ¡str.length(); ¡i++) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡result ¡+= ¡str.charAt(i); ¡ ¡ ¡ ¡ ¡return ¡result ¡% ¡BUCKETS; ¡ } ¡
We ¡can ¡treat ¡chars ¡as ¡numbers ¡ and ¡sum ¡their ¡values. ¡
9 ¡
private ¡class ¡Pair ¡ { ¡ ¡ ¡ ¡ ¡String ¡key; ¡ ¡ ¡ ¡ ¡String ¡value; ¡ ¡ ¡ ¡ ¡ ¡public ¡Pair(String ¡key, ¡String ¡value) ¡ ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡this.key ¡= ¡key; ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡this.value ¡= ¡value; ¡ ¡ ¡ ¡ ¡} ¡ } ¡
10 ¡
public ¡static ¡final ¡int ¡BUCKETS ¡= ¡256; ¡ ¡ public ¡static ¡final ¡int ¡INIT_SIZE ¡= ¡16; ¡ private ¡Pair[][] ¡buckets= ¡new ¡Pair[BUCKETS][INIT_SIZE]; ¡ ¡ public ¡void ¡put(String ¡key, ¡String ¡value) ¡ { ¡ ¡ ¡ ¡ ¡int ¡bucket ¡= ¡hash(key); ¡ ¡ ¡ ¡ ¡for ¡(int ¡i ¡= ¡0; ¡i ¡< ¡buckets[bucket].length; ¡i++) ¡ ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡if ¡((buckets[bucket][i] ¡== ¡null) ¡|| ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡(buckets[bucket][i].key.equals(key))) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡buckets[bucket][i] ¡= ¡new ¡Pair(key, ¡value); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡return; ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡} ¡ ¡ ¡ ¡ ¡} ¡ ¡ ¡ ¡ ¡ ¡int ¡current ¡= ¡buckets[bucket].length; ¡ ¡ ¡ ¡ ¡Pair ¡[] ¡copy ¡= ¡new ¡Pair[current ¡* ¡2]; ¡ ¡ ¡ ¡ ¡for ¡(int ¡i ¡= ¡0; ¡i ¡< ¡current; ¡i++) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡copy[i] ¡= ¡buckets[bucket][i]; ¡ ¡ ¡ ¡ ¡copy[current] ¡= ¡new ¡Pair(key, ¡value); ¡ ¡ ¡ ¡ ¡buckets[bucket] ¡= ¡copy; ¡ } ¡
11 ¡
public ¡String ¡get(String ¡key) ¡ { ¡ ¡ ¡ ¡ ¡int ¡bucket ¡= ¡hash(key); ¡ ¡ ¡ ¡ ¡for ¡(int ¡i ¡= ¡0; ¡i ¡< ¡buckets[bucket].length; ¡i++) ¡ ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡if ¡(buckets[bucket][i] ¡== ¡null) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡return ¡null; ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡if ¡(buckets[bucket][i].key.equals(key)) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡return ¡buckets[bucket][i].value; ¡ ¡ ¡ ¡ ¡} ¡ ¡ ¡ ¡ ¡return ¡null; ¡ } ¡
12 ¡
public ¡static ¡void ¡main(String ¡[] ¡args) ¡ { ¡ ¡ ¡ ¡ ¡StringToStringHash ¡map ¡= ¡new ¡StringToStringHash(); ¡ ¡ ¡ ¡ ¡Stats ¡timer1 ¡= ¡new ¡Stats(); ¡ ¡ ¡ ¡ ¡while ¡(!StdIn.isEmpty()) ¡ ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡String ¡key ¡ ¡ ¡= ¡StdIn.readString(); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡String ¡value ¡= ¡StdIn.readString(); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡map.put(key, ¡value); ¡ ¡ ¡ ¡ ¡} ¡ ¡ ¡ ¡ ¡System.out.println("Loading ¡data:\n" ¡+ ¡timer1); ¡ ¡ ¡ ¡ ¡ ¡Stats ¡timer2 ¡= ¡new ¡Stats(); ¡ ¡ ¡ ¡ ¡for ¡(int ¡i ¡= ¡0; ¡i ¡< ¡10000; ¡i++) ¡ ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡String ¡value ¡= ¡map.get("20090827,JCP"); ¡ ¡ ¡ ¡ ¡} ¡ ¡ ¡ ¡ ¡System.out.println("Using ¡map:\n" ¡+ ¡timer2); ¡ } ¡
% ¡java ¡StockDataHash ¡< ¡sp500_2009.txt ¡ ¡ Loading ¡data: ¡ elapsed ¡(s) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡: ¡0.861 ¡ heap ¡memory ¡used ¡(KB) ¡: ¡38017 ¡ ¡ Using ¡map: ¡ elapsed ¡(s) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡: ¡0.086 ¡ heap ¡memory ¡used ¡(KB) ¡: ¡38017 ¡ % ¡java ¡StockDataDumb ¡< ¡sp500_2009.txt ¡ ¡ Loading ¡data: ¡ elapsed ¡(s) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡: ¡63.0 ¡ heap ¡memory ¡used ¡(KB) ¡: ¡39571 ¡ ¡ Using ¡map: ¡ elapsed ¡(s) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡: ¡10.517 ¡ heap ¡memory ¡used ¡(KB) ¡: ¡39571 ¡ % ¡java ¡StockDataHashMap ¡< ¡sp500_2009.txt ¡ ¡ Loading ¡data: ¡ elapsed ¡(s) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡: ¡0.276 ¡ heap ¡memory ¡used ¡(KB) ¡: ¡38017 ¡ ¡ Using ¡map: ¡ elapsed ¡(s) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡: ¡0.0050 ¡ heap ¡memory ¡used ¡(KB) ¡: ¡38017 ¡
Java’s ¡HashMap: ¡ The ¡Winner! ¡ My ¡class: ¡ ¡ (bad) ¡hash ¡func/on ¡ My ¡class: ¡ ¡ no ¡hashing ¡
13 ¡
14 ¡
15 ¡
public ¡class ¡HelloHashSet ¡ ¡ { ¡ ¡ ¡ ¡public ¡static ¡void ¡main(String ¡[] ¡args) ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡HashSet<String> ¡set ¡= ¡new ¡HashSet<String>(); ¡
¡
¡ ¡ ¡ ¡ ¡ ¡set.add("carrot"); ¡ ¡ ¡ ¡ ¡ ¡ ¡set.add("apple"); ¡ ¡ ¡ ¡ ¡ ¡ ¡set.add("carrot"); ¡
¡
¡ ¡ ¡ ¡ ¡ ¡System.out.println("set ¡size ¡= ¡" ¡+ ¡set.size()); ¡ ¡ ¡ ¡ ¡ ¡ ¡if ¡(set.contains("apple")) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡System.out.println("I ¡spy ¡a ¡fruit!"); ¡ ¡ ¡ ¡} ¡ } ¡ % ¡java ¡HelloHashSet ¡ set ¡size ¡= ¡2 ¡ I ¡spy ¡a ¡fruit! ¡
16 ¡
HashSet<String> ¡dict ¡= ¡new ¡HashSet<String>(); ¡ ¡ try ¡ { ¡ ¡ ¡ ¡Scanner ¡scan ¡= ¡new ¡Scanner(new ¡File(args[0])); ¡ ¡ ¡ ¡while ¡(scan.hasNext()) ¡ ¡ ¡ ¡ ¡ ¡ ¡dict.add(scan.next().toLowerCase()); ¡ ¡ ¡ ¡scan.close(); ¡ } ¡ catch ¡(FileNotFoundException ¡e) ¡ { ¡ ¡ ¡ ¡e.printStackTrace(); ¡ ¡ ¡ ¡return; ¡ } ¡ ¡ for ¡(String ¡s ¡: ¡dict) ¡ ¡ ¡ ¡System.out.println(s); ¡
17 ¡
HashSet<String> ¡dict ¡= ¡new ¡HashSet<String>(); ¡ try ¡ { ¡ ¡ ¡ ¡Scanner ¡scan ¡= ¡new ¡Scanner(new ¡File(args[0])); ¡ ¡ ¡ ¡while ¡(scan.hasNext()) ¡ ¡ ¡ ¡ ¡ ¡ ¡dict.add(scan.next().toLowerCase()); ¡ ¡ ¡ ¡scan.close(); ¡ ¡ ¡ ¡ ¡scan ¡= ¡new ¡Scanner(new ¡File(args[1])); ¡ ¡ ¡ ¡while ¡(scan.hasNext()) ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡String ¡word ¡= ¡scan.next() ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡.toLowerCase() ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡.replaceAll("[^a-‑z']", ¡""); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡if ¡(!dict.contains(word)) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡System.out.println(word); ¡ ¡ ¡ ¡} ¡ ¡ ¡ ¡scan.close(); ¡ } ¡ catch ¡(FileNotFoundException ¡e) ¡ { ¡ ¡ ¡ ¡e.printStackTrace(); ¡ } ¡
¡
(convert ¡all ¡words ¡to ¡lower ¡case, ¡ strip ¡any ¡character ¡except ¡for ¡a-‑z ¡ and ¡apostrophe) ¡
18 ¡
add(Object ¡o) ¡
size() ¡
contains(Object ¡o) ¡
false ¡otherwise. clear() ¡
remove(Object ¡o) ¡
19 ¡
20 ¡
21 ¡
22 ¡
public ¡static ¡void ¡main(String ¡[] ¡args) ¡ { ¡ ¡ ¡ ¡ArrayList<String> ¡words ¡= ¡new ¡ArrayList<String>(); ¡ ¡ ¡ ¡try ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡Scanner ¡scan ¡= ¡new ¡Scanner(new ¡File(args[0])); ¡ ¡ ¡ ¡ ¡ ¡ ¡while ¡(scan.hasNext()) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡words.add(scan.next()); ¡ ¡ ¡ ¡ ¡ ¡ ¡scan.close(); ¡ ¡ ¡ ¡} ¡ ¡ ¡ ¡catch ¡(FileNotFoundException ¡e) ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡e.printStackTrace(); ¡ ¡ ¡ ¡ ¡ ¡ ¡return; ¡ ¡ ¡ ¡} ¡ ¡ ¡ ¡ ¡Collections.sort(words); ¡ ¡ ¡ ¡ ¡for ¡(String ¡s ¡: ¡words) ¡ ¡ ¡ ¡ ¡ ¡ ¡System.out.println(s); ¡ } ¡
% ¡java ¡WordsSorted ¡ wiki10.txt ¡ a ¡ a ¡ a ¡ a ¡ a ¡ ailment ¡ an ¡ and ¡ and ¡ and ¡ and ¡ and ¡ appointed ¡
23 ¡
and ¡ ¡ ¡ ¡ ¡0.0148 ¡ is ¡ ¡ ¡ ¡ ¡ ¡0.00987 ¡ in ¡ ¡ ¡ ¡ ¡ ¡0.00904 ¡ to ¡ ¡ ¡ ¡ ¡ ¡0.00791 ¡ was ¡ ¡ ¡ ¡ ¡0.00676 ¡
for ¡ ¡ ¡ ¡ ¡0.00535 ¡ the ¡ ¡ ¡ ¡ ¡0.00535 ¡
that ¡ ¡ ¡ ¡0.00494 ¡ ... ¡
24 ¡
ArrayList<Word> ¡entries ¡= ¡new ¡ArrayList<Word>(); ¡
¡
try ¡ { ¡ ¡ ¡ ¡Scanner ¡scan ¡= ¡new ¡Scanner(new ¡File(args[0])); ¡ ¡ ¡ ¡while ¡(scan.hasNext()) ¡ ¡ ¡ ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡String ¡word ¡= ¡scan.next(); ¡ ¡ ¡ ¡ ¡ ¡ ¡double ¡prob ¡= ¡scan.nextDouble(); ¡ ¡ ¡ ¡ ¡ ¡ ¡if ¡(word.length() ¡> ¡0) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡entries.add(new ¡Word(word, ¡prob)); ¡ ¡ ¡ ¡} ¡ ¡ ¡ ¡scan.close(); ¡ } ¡ catch ¡(FileNotFoundException ¡e) ¡ { ¡ ¡ ¡ ¡e.printStackTrace(); ¡ ¡ ¡ ¡return; ¡ } ¡
¡
Collections.sort(entries); ¡
¡
for ¡(Word ¡e ¡: ¡entries) ¡ ¡ ¡ ¡System.out.println(e); ¡
% ¡javac ¡SortWord.java ¡ SortWord.java:32: ¡error: ¡no ¡suitable ¡method ¡found ¡for ¡sort(ArrayList<Word>) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Collections.sort(entries); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡^ ¡ ¡ ¡ ¡ ¡method ¡Collections.<T#1>sort(List<T#1>) ¡is ¡not ¡applicable ¡ ¡ ¡ ¡ ¡ ¡ ¡(inference ¡variable ¡T#1 ¡has ¡incompatible ¡bounds ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡equality ¡constraints: ¡Word ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡upper ¡bounds: ¡Comparable<? ¡super ¡T#1>) ¡ ¡ ¡ ¡ ¡method ¡Collections.<T#2>sort(List<T#2>,Comparator<? ¡super ¡T#2>) ¡is ¡not ¡applicable ¡ ¡ ¡ ¡ ¡ ¡ ¡(cannot ¡infer ¡type-‑variable(s) ¡T#2 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡(actual ¡and ¡formal ¡argument ¡lists ¡differ ¡in ¡length)) ¡ ¡ ¡where ¡T#1,T#2 ¡are ¡type-‑variables: ¡ ¡ ¡ ¡ ¡T#1 ¡extends ¡Comparable<? ¡super ¡T#1> ¡declared ¡in ¡method ¡<T#1>sort(List<T#1>) ¡ ¡ ¡ ¡ ¡T#2 ¡extends ¡Object ¡declared ¡in ¡method ¡<T#2>sort(List<T#2>,Comparator<? ¡super ¡T#2>) ¡ 1 ¡error ¡
25 ¡
26 ¡
% ¡java ¡SortWord ¡entries.txt ¡ moore ¡(prob ¡0.000058 ¡audio ¡'') ¡ bull ¡(prob ¡0.000058 ¡audio ¡'') ¡ craft ¡(prob ¡0.000058 ¡audio ¡'') ¡ periodically ¡(prob ¡0.000058 ¡audio ¡'') ¡ founder ¡(prob ¡0.000058 ¡audio ¡'') ¡ nick ¡(prob ¡0.000058 ¡audio ¡'') ¡ sanctions ¡(prob ¡0.000058 ¡audio ¡'') ¡ manufactured ¡(prob ¡0.000058 ¡audio ¡'') ¡ drill ¡(prob ¡0.000058 ¡audio ¡'') ¡ ... ¡
27 ¡
% ¡java ¡SortWord ¡entries.txt ¡ and ¡(prob ¡0.014800 ¡audio ¡'') ¡ is ¡(prob ¡0.009870 ¡audio ¡'') ¡ in ¡(prob ¡0.009040 ¡audio ¡'') ¡ to ¡(prob ¡0.007910 ¡audio ¡'') ¡ was ¡(prob ¡0.006760 ¡audio ¡'') ¡
for ¡(prob ¡0.005350 ¡audio ¡'') ¡ the ¡(prob ¡0.005350 ¡audio ¡'') ¡
... ¡
28 ¡