I understand what you want and think the best course of action would be to ask in a more programming-related forum. The complexity of this request exceeds what normal "mortals" would know right off the bat

Like me, I've made some binary search trees, but would have to do a lot of research to learn if I could help with your problem.
Good luck figuring it out!
Edit: Ok, I came up with something. This is not a solution, more like an idea that will take up a lot of storage space, but will be relatively fast (don't ask me about math

).
- You make a search tree of depth n where each node represents a character in the alphabet and splits in to 26 nodes (a-z). The number of nodes will be 1+ 26^n I guess.
- Each bottom node will have a list of words that all start with the combination of characters on the path from the root to the last node. For instance, if you go through the nodes containing 's' and 'i' and 'i' was the last node on the path, you would find words like 'ck' (sick), 'ckle' (sickle), 'nce' (since) in its string list. Any combination of characters that doesn't produce any words, will just have a null or false variable, so you fast and easy know its a dead-end.
- The idea is to split up the string you want words from into a char array, then go through the tree from root to end
recursively. Meaning, if you have the string 'apple', you start with a, mark 'a' as used, then from the 'a' node, go through the 'p' node, mark 'p' as used, then go through the 'p' node connected to the last 'p' node, mark the second 'p' as used, then 'l', then 'e' until you are
1. ...out of characters, if you didn't reach a string-list, the word you're going through doesn't exist (in your data-structure at least).
2. ...reach a string-list, in which you iterate through and use nested loops or whatever to filter out all words that matches the combination of the remaining characters (that haven't been marked as 'used').
3. ...reach a dead-end, in other words a false boolean or empty string-list, meaning the current combination of characters doesn't form any word known here.
For each node you come to where you have multiple unmarked characters remaining, you will have to visit one node for each one (make a "thread" for each).
- To summarize:
Lets say you have the word 'apple'. Instead of making 5! search calls. This method will try a,p,p,l,e then a,p,l and stop there (instead of trying a,p,l + any combination of the remaining characters), because no words exist that start with 'apl'. You could to the same with a string array, but then a search call would take forever.