The idea is to encode the whole dictionary pre-boggle game into a decision tree where each leaf is a word that is valid. While doing the search on the boggle game, we would always early stop when the path we are going into isn't leading to anymore words.
This will ensure optimal search because everything is properly structured beforehand to be able to do the lookup in O(1) and without any extra wasteful work!
I got a tree going that encode the dictionary now, next up I just need to modify the boggle algorithm to be able to traverse the tree to check if the word work.
The idea is to encode the whole dictionary pre-boggle game into a decision tree where each leaf is a word that is valid. While doing the search on the boggle game, we would always early stop when the path we are going into isn't leading to anymore words.
This will ensure optimal search because everything is properly structured beforehand to be able to do the lookup in O(1) and without any extra wasteful work!