DEV Community

Cover image for PDF Booklet: Understand recursion with these 8 JavaScript examples for beginners
Adrian
Adrian

Posted on

1

PDF Booklet: Understand recursion with these 8 JavaScript examples for beginners

Recursion is one of the most useful but very little understood programming technique. There are special kind of problems that can be solved very easy and elegant with a recursive function (e.g. locating a file in an hierarchical file system).

This article doesn't intend to offer an explanation of how recursion works ... but instead it offers you a PDF booklet with 8 classical problems implemented both using a recursive solution as well as an iterative solution.

As you'll see ... for some problems recursion comes more naturally, as for the others it should not be the first choice.

How to run the code?

Examples from this article have been developed using the codeguppy.com editor. If you never tried codeguppy.com before, now is a good time to give it a try.

However just by replacing println() with console.log() you can run it in any environment you prefer.

Download PDF

PDF Booklet

https://codeguppy.com/site/download/recursive_problems.pdf

Next steps

The PDF booklet shows one way of implementing these problems. If you come up with a new solution, please send us a message on Twitter at @codeguppy... or leave a comment here.

Top comments (0)

nextjs tutorial video

Youtube Tutorial Series 📺

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series 👀

Watch the Youtube series

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay