Sunday, 18 August 2013

Program to read file then count the frequency of word and sort the result by frequency then by alphabetically in java

Program to read file then count the frequency of word and sort the result
by frequency then by alphabetically in java

EXAMPLE
if file contains following
a b c d aa bb cc aa bb cc dd dd aaa bbb aaa ccc aaa bbb ccc bbb ccc aaa
bbb ccc dad
answer should be like this
a 1
b 1
c 1
d 1
dad 1
aa 2
bb 2
cc 2
dd 2
aaa 3
bbb 3
ccc 3

No comments:

Post a Comment