I walked through the example code and I’ll be honest. I struggled. I tried to write out the process step by step as a string is given to the code but I failed. Now, because I am so confident, I thought that there must be something wrong with the code in the book because I could NEVER make a mistake or misunderstand something. So to prove myself right (lol) I wrote out the code and ran the program with the string “Dave”.
TLDR;
Okay, so here are the highlights of what I did:
- Still reading through the book “Cracking the Coding Interview” by Gayle Laakmann McDowell. Still working on example twelve. After running the program to see the results for my test string it seemed to do exactly what it should. It printed all the different versions (permutations) of the string provided. In my case I passed it the string “Dave”. Although it gave me the result I thought it would I am still confused on how the recursive calls work with the parameters to produce these results. I think I need one more day with this in order to really get to the bottom of this.
Conclusion
That’s all for today. If you are interested in the MIT course you can check out the video lecture I’m currently going through. The lecture is helpful but isn’t sufficient by itself. Anyways, until next time PEACE!