Took the time to breakdown the great mathematical approach to calculating the time complexity for a simple recursive algorithm. I mentioned this yesterday but today I compared it to the approach mentioned in the book, “Cracking the Coding Interview”. It felt great because I got to apply some of the math principles I had covered recently to prove that both methods produce the same answer. It really feels like I am slowly building and getting a better grasp of what is going on. Just goes to show that if you stay consistent things will eventually get better.
TLDR;
Okay, so here are the highlights of what I did:
- Still reading through the book “Cracking the Coding Interview” by Gayle Laakmann McDowell. Since I am stuck on practice problem eleven I am trying to review the concept of Recursion and determining the time complexity for recursive algorithms. I am currently going through a list of randomly selected YouTube videos on the topic. I figure the more exposure I have to the topic the more opportunities I have to find hints on how to improve my process. Today I walked through a method presented in one video. I compared it’s method for calculating the time complexity with a derived math formula to the generic formula given in the book of
O(branches ^ depth)
. I was able to get the same result when I used the derived equation ofT(n) = 3k + T(n-k)
in the base case scenario wheren = k
. The end result wasT(n) = 3n + 1
When Big O notation rules are applied the result was the sameO(n)
as in generic formula.
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.