A beginner's question on String matching
Hello everyone, as you might see, I'm new here, and in general pretty much a newbie when it comes to Java.
I'm working on a school assignment, and was wondering if anyone could help me find a simple solution to a problem that seems complicated at first sight. What I'm aiming to do is find the fastest way to match a random jumble of letters (or a subset of said jumble, but that can be dealt with easily once the general method is at hand) with about a zillion entries in a dictionary.
The aim of this is to find a quick solution for a certain game show, where one is presented with a bunch of letters in random order, and instructed to find the longest word possible with said letters.
The long, difficult, and most of all (to me) dark way to do this, is take all possible combinations of the letters and try to match those exactly with the entries in the dictionary. Not only do I not clearly see the method of how to do this, but it also seems to me like it would take an awfully long time.
My intuitive solution was then, just to match the content of the jumbled-up word to every word in a dictionary, in a way which would not take into account the actual order of the letters in the word. If there should be such a match, i would have saved myself quite a few hundred thousand tests, not to mention processing time. I'd then just have to return the word in the dictionary that matched the random sequence of letters, and voilą!
Any help on this topic would be highly appreciated, and if my magical solution is impossible, I'd appreciate help on the sluggish first method as well!