[algogeeks] Re: Word printing Program

2012-06-09 Thread rammar
While you are reading words from the file, maintain a hash table. For each word encountered, update the hash count. Once the input file is exhausted, sort the hash table in O(logN) and print the list. A good hash function will be appreciated... else use the hash+=31*(*str) function and also

[algogeeks] Re: Word printing Program

2012-06-09 Thread Dave
@Navin: In Unix-speak, assuming one word per line in file f: sort f | uniq -c | sort -n -r I'm measuring efficiency by number of characters typed to implement the solution. Dave On Saturday, June 9, 2012 8:51:28 AM UTC-5, Navin Kumar wrote: Write an efficient program that prints the