The cheat code to getting good at Recursive Programming[Technique Tuesday]
Once you do this, you will never struggle with recursion again.
So you want to get good at recursion?
No doubt a skill you need to work at a top tech company like Google or Facebook. Also one of the most powerful ideas in Computer Science. One you will use to come up with all kinds of solutions. So yeah, you will need to get good at it.
I have to two posts detailing recursion already. One is a Mathematical Perspective, to help you understand the foundations of Recursion. The other is a good step-by-step process to be able to come up with a recursive algorithm to solve questions.
However, there is one final piece of the puzzle missing. These posts were focused on the theoretical knowledge and problem-solving aspects of the interview respectively. To truly ace your interview, you also need to be good at coding. So how can you get good at coding up recursive solutions? Simple, by doing more recursion. Find more recursion questions, and code them up. Simple.
And that is the advice most people online will give you. I have nothing against that advice, it’s solid stuff. But I have something better for you. You can boost your recursive programming skills, without forcing yourself to go through tons of questions. The key to this technique is to get some exposure to Functional Programming, a very interesting programming paradigm. Functional Programming is very powerful because it forces you to think in a purely recursive way, which will force you to really work. This is a good thing.
So how can you get started? The first important point is to find a language. I personally recommend Haskell or Lisp, but as long as you follow the functional style, you will be fine. Most languages (even Java, the poster child for OOP) support Functional Programming these days. Once you have a language of choice, look into solving these specific questions-
Sorting, Searching, Reversing, and Length (of) a List. Merging lists is another good one.
List Math. Includes adding values to all values in a list, summing the elements of a list, etc etc.
Factorial, Ackermann, and other classically recursive functions.
None of these questions are super hard. The point of this exercise is to get you good at Coding Recursion, so I won’t go into the more esoteric questions we can do. They won’t be worth it. The above list will provide you with the needed foundation.
If you want more details on Functional Programming, and how it can help you, read my article - How to get good at Recursion. It will cover all the relevant information for you to get started. Now get out there and code.
In the comments below, share what topic you want to focus on next. I’d be interested in learning and will cover them. To learn more about the newsletter, check our detailed About Page + FAQs
If you liked this post, hit the heart button and let Substack know. Make sure you fill out this survey. It’s anonymous and will take 2 minutes of your time. It will help me understand you better, allowing for better content.
https://forms.gle/XfTXSjnC8W2wR9qT9
Happy Prep. I’ll see you at your dream job.
Haskell is one of my favs,
Devansh <3
To make sure you get the most out of Technique Tuesdays, make sure you’re checking in the rest of the days as well. Leverage all the techniques I have discovered through my successful tutoring to easily succeed in your interviews and save your time and energy by joining the premium subscribers down below. Get a discount (for a whole year) using the button below
Reach out to me on:
Instagram:Â https://www.instagram.com/iseethings404/
Message me on Twitter:Â https://twitter.com/Machine01776819
My LinkedIn:Â https://www.linkedin.com/in/devansh-devansh-516004168/
My content:
Read my articles:Â https://rb.gy/zn1aiu
My YouTube:Â https://rb.gy/88iwdd
Get a free stock on Robinhood. No risk to you, so not using the link is losing free money: https://join.robinhood.com/fnud75