DEV Community

Jasterix
Jasterix

Posted on

2 1

Grokking Algorithms – Recursions

Part of being a JavaScript ninja is being somewhat proficient at tackling algorithms or what I've been calling "bite-sized trickery".

As a relative beginner, I've been coming across what seems like the same 10 problems in different shapes, colors and sizes a.k.a varying levels of difficulty.

Struggling to solve this problem for 4 hours made me realize that when it came to algorithms, I had no idea where to begin. While Flatiron gave me great set of fundamental tools, these tools or rather, how I'm used to applying them, aren't always the the best fit for solving LeetCode problems.

So I decided to pick up Grokking Algorithms by Aditya Bhargava. This book has been recommended to me a few times, but I initially chose to learn by doing, which was less than successful.

Still, ever the rebel, I decided to start with chapter 3: recursions.

Here are my 3 takeaways on recursions

  1. Recursion is when a function calls itself
  2. Every recursive function has 2 cases:
    1. the base case– the function completes executing and
    2. the recursive case– the function calls itself
  3. This means that while each function call goes onto the call stack, those function calls don't complete until the base case is met

Check out Grokking Algorithms at your local library or on Amazon

Heroku

Amplify your impact where it matters most — building exceptional apps.

Leave the infrastructure headaches to us, while you focus on pushing boundaries, realizing your vision, and making a lasting impression on your users.

Get Started

Top comments (0)

Image of PulumiUP 2025

Let's talk about the current state of cloud and IaC, platform engineering, and security.

Dive into the stories and experiences of innovators and experts, from Startup Founders to Industry Leaders at PulumiUP 2025.

Register Now

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay