top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

Sort Word based on it's occurences

0 votes
139 views

There are several words in a file. Get the occurrence of every word and sort it based on the occurrence, if more than one word is having same occurrence than sort it alphabetically.

Is there any approach better than HashMap??

HashMap Approach
1) Collect all different words in HashMap
2) If any word repeats increase it's count.
3) Now sort base on count
4) Sort words within same count.

posted Sep 11, 2014 by Atiqur Rahman

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

By Using External Sorting method with HashMap procedure is best approach to sort words in a file.

answer Sep 23, 2014 by Aarti Jain
Similar Questions
+2 votes
+3 votes

1) Implement both algorithms
2) Test both on three cases of data:
a) sorted in increase order,
b) sorted in decrease order,
c) randomly
3) Use data of different sizes: 10000, 100000, 1000000.

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...