# Data Structures and Algorithm Concepts: Recursion

What is a recursive function and why are they extremely important in understanding algorithms? I’m going to explain with Data Structures and Algorithm Concepts: Recursion.

In the simplest terms possible, a recursive function is a function that calls upon a smaller version of itself in order to get to the solution. There is a pattern where by repeating the function over and over again, we can arrive at the solution. One of the key points of recursion is that it must have a base case, or a case when the recursion must stop. This is known as the end condition.

The reason I have matryoshka dolls as the photo above is because it is a very good visual representation of what recursion is like. Every single doll has a smaller version of itself inside until we reach the absolute smallest one — in which it no longer has any more smaller ones within it. In a recursive function, the smallest one would be the base case.

Let’s go over a simple problem that could utilize recursion. In a previous blog post, I went over reversing a string. Well, did you know that there’s a recursive solution to that which only requires 3 lines of code?

## Hire Dedicated JavaScript Developers -Hire JavaScript Developers

Hire dedicated JavaScript Developers who are proficient in AngularJS, ReactJS, NodeJS, & VueJS frameworks. Get flexible hiring models as per your business requirements.

## JavaScript Shopping Cart - Javascript Project for Beginners

JavaScript Shopping Cart - javascript shopping cart tutorial for beginnersBuy me a coffee 🍺 https://www.paypal.com/paypalme/ziddahSource Code: https://bit....

## The essential JavaScript concepts that you should understand

The essential JavaScript concepts that you should understand - For successful developing and to pass a work interview

## Data Types In JavaScript

JavaScript data types are kept easy. While JavaScript data types are mostly similar to other programming languages; some of its data types can be unique. Here, we’ll outline the data types of JavaScript.

## Introduction With Basic JavaScript

Introduction With Basic JavaScript - Unlike most programming languages, the JavaScript language has no concept of input or output. It is designed to run as a scripting language in a host environment, and it is up to the host environment to provide mechanisms for communicating with the outside world.