I am still struggling to understand what I did wrong and why my formula does not work. I tried to use the formula for the other problems with a mixed bag of results. Towards the end I looked through some other recursive algorithm problems and noticed a trend. All simple recursive algorithm problems almost always do a constant amount of work both in the base case as well as in the recursive case. It is only in more complicated recursive algorithms that I would see something different. I think this is the key to explaining why the simple formula of O(braches^depth)
works for simple recursive algorithms but does not for complex problems. More research is needed for sure.
TLDR;
Okay, so here are the highlights of what I did:
- Still reading through the book “Cracking the Coding Interview” by Gayle Laakmann McDowell. Tested out my generic recursive algorithm formula on a few more examples but it only worked on more complicated recursive algorithms. That got me thinking that there may be something I am missing. I believe it has to do with the amount of processing being performed during the recursive and base cases. They seem to be the key difference. I need to continue down this thought path. Still sucks to be stuck on the same problem but I think I may have found the hint that will bring this whole mess together. lol.
Conclusion
That’s all for today. This is my sixth round of the “#100daysofcode” challenge. I will be continuing my work from round five into round six. I am currently working through the book “Cracking the Coding Interview” by Gayle Laakmann McDowell. My goal is to become more familiar with algorithms and data structures. This goal was derived from my goal to better understand operating systems and key programs that I use in the terminal regularly e.g. Git. This goal was in term derived from my desire to better understand the fundamental tools used for coding outside of popular GUIs. This in turn was derived from my desire to be a better back-end developer.
I have no idea if my path is correct but I am walking down this road anyways. Worst case scenario I learn a whole bunch of stuff that will help me out on my own personal projects.