What is Recursion?!

What is a recursion?

Infinite recursion

def recurse():
recurse()

Why use recursion?

def recurse(x):# base case:   
if (x == 4)
return(1);
recurse(x - 1)

How to use recursion?

  • a recursive call
  • base case.

Let’s see an example below:

functions that’s use recursion
example of the recursion
heap until the stop cnditional is true
In here we can se that the result will be x*x*x (y times)

Conclusion:

--

--

--

Software engineer in progress

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Best Time to Buy and Sell Stock with Cooldown

Apache Kafka Producer/Consumer using Spring Boot

[Unity at GDC] C# to Machine Code

My GitHub Workflow for Improved Productivity

Buildpack Basics For Docker Captains

Making Network Calls from Terminal, over PdaNet WiFi Direct.

It’s Time to Trust Your Vision and Tune Out the Noise

Reactive Programming in Android using RxJava and RxAndroid

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Katherine Soto

Katherine Soto

Software engineer in progress

More from Medium

Recursive Probability Problems

Not Done That Problem

Number of Good Pairs | Python Solution | LeetCode Easy Problem #1512

What is dynamic programming and how to approach problems based on dynamic programming?