Alright, I had to design an N-ary tree so later I could use it to produce a word ladder. I got the tree to insert and print perfectly. Now what I need to do is add pointers so that everything points to the correct item.
Here's the example: Connect cat to dog
This is my test dictionary:
cat hat bat bag bog bot eat fat fan mad mat cot dog cog
So, I sorted it in respect to cat to avoid any issues, and then got everything inserted into the tree. So, at the moment, this is what I have. Image Here
What I need is every word to point to other words that are one letter off, like this (I apologize for how cramped it is). Second Image
So, I figure I need a new function that connects them all in such a way, which basically means I just need to pick a node, and compare it to all the other nodes in the tree.
Is there any short cut I could take? Like, if the difference hits a large number that it's unlikely that they will get close after that.
And, how do I avoid making sure that I don't add a pointer that already points to something. Like, bog points to dog already. How do I avoid bog adding another point to dog already?