C++ - Efficient way to iterate over the contents of a vector?
- by Francisco P.
Hello, everyone!
I am implementing a text-based version of Scrabble for a college project.
I have a vector containing around 400K strings (my dictionary), and, at some point in every turn, I'm going to have to check if any word in the dictionary can be formed with the pieces in the player's hand.
My only solution to this is iterating through the string, one by one, and using a sub-routine I have to check if the string in question can be formed from the player's pieces. I'll implement a quickfail checking if the user has any vowels, but it'll still be woefully inefficient.
Any suggestions?
Thanks for your time!