Find the most frequent words from a file

Hello everyone,
I have a project from data structers and algorithms. However, I have some problems about the project. My project is about find the most frequent word in .csv file. Also, I don't know how I can do it. Please help me.
Note:
Using Vector library, algorithm library, STL library and iterator are forbidden.

I can only use hash algorithm,serch algorithm ,sorting, linkdelist, arraylist and hashing.
This is a surprisingly common problem. It's tricky because at first you're looking up words by value (to increment their frequency count) and then you want to look them up by frequency (to find the most frequent one(s)). I use this UNIX command line all the time at work to sort lines in a text file by frequency: sort | uniq -c | sort -n

Start with a struct of a word and it's frequency:
1
2
3
4
struct WordAndFreq {
    string word;
    unsigned freq {0};
};


Now make a hash table of these, hashed by word.

As you read the file, lookup each word in the hash table. Insert it if not found. Increment the frequency.

After reading the csv, go through the entire hash table and find the word with the highest frequency.

Once you have something working, you may find that you to normalize the words before looking them up.
"You should code carefully," I say to you, "or you'll find you have errors."

The word "you" appears 4 times here with different capitalization and with punctuation before, within, and after the space-separated words.
are there any examples which are I can use?
You will learn more if you write your own code.
you have a point, but I don't have enough information deal with this project. I have some problems in school.
Look around this forum for implementations of a hash table.
Do you know how to implement a linked list or dynamic array?
Using one of the two with a struct (first answer of dhayden) seems the easiest option.
Using a hashtable seems more complicated unless you have learned it already.

How does your input file look like ?
Topic archived. No new replies allowed.