I want to make an algorithm for changing one word to other. For example the given word is “MUD” and I need to convert it to “BED”. For each iteration I can change one character, but that should form an another meaningful word. For example “MUD” can be change as “MAD”. Like this I need to find the shortest path to convert the “MUD” to “BED”.
A separate method is provided for finding the valid word. IsWord() is a method which will give us the boolean result whether the given string is valid or not. So dont need to worry about that.
I also dont need to worry about efficiency or lines of code , etc. Do any one have any idea how to make this algorithm. If so please help me.
Thanks in Advance.
(I know that we have to use tree and have to do binary traversal, but I have no idea how to use it in this algorithm)
This is called a word ladder.
Check out the post The Longest Word Ladder Puzzle Ever on Wolfram Blog.