## DEV Community

Tamerlan Gudabayev

Posted on • Updated on

# Algorithms: Recursion

There are just way to many algorithms in the world.

Fortunately, you don't have to learn them all.

They all mostly come in certain types.

One of these types is recursion.

That's what we will be discussing today.

What you will learn today:

• What is recursion?
• Recursive algorithms

## Recursion

Recursion put simply is when a function calls itself.

But why would it do that?

Because it breaks down the problems into subproblems.

This is the main premise of recursion, breaking down big problems into subproblems.

Here's a simple example:

``````function countDown(num){
if(num == 0){
return console.log(0)
}

console.log(num)
countDown(num - 1)
}
``````

## Recursive Algorithms

There are many algorithms that use recursion but the most notable ones are:

• Merge Sort
• Quick Sort
• Binary Search
• Greatest Common Divisor (GCD)

## Conclusion

Today was a pretty simple post, we learned what recursion is, and what algorithms use it. I hope you learned something today, and stay tuned for next week.