go to start Ex W10
|home |print view |recent changes |changed November 15, 2017 |
exact
|You are 54.81.139.56 <- set your identity!

Sections: Algorithm Exercises | wseventh - count words and print out 7th most frequent | woccurrence - cross reference with line numbers |

Algorithm Exercises ^

wseventh - count words and print out 7th most frequent ^

Similar to the wfavorite program from last week, only print the 7th most frequent word.

Do not reuse exact code of wfavorite, but again use the most optimal data structure and algorithms for this problem.

woccurrence - cross reference with line numbers ^

Read a text from standard input line by line. While reading count the line numbers. Create a data structure that keeps each word (use your word class) together with all line numbers it occurs upon. Print out a sorted list of words (one word per line), each followed by a list of the line numbers it occurs upon.

Example input:

Hello
Hello again
Song by who?
output:
again 2 
by 3 
Hello 1 2 
Song 3 
who 3 


|home |print view |recent changes |changed November 15, 2017 |
exact
|You are 54.81.139.56 <- set your identity!

Ex W10
go to start