1) Take in a word.
2) See if it's already a known word in the list
2a) If it's not in the list, create a new node and set the counter to 1
2b) If it's in the list then set that node's counter +1
3) Print out the results
An advanced version of this would do something fancy about what order the words are stored in - the first implementation will no doubt be unordered and thus slow after the words go on. I'm not sure yet of the best way to store words such that scanning to find a word is fast. I somewhat recall a way of doing this using a tree structure, but that's after I've gotten more list experience under my belt.
No comments:
Post a Comment