+ 7

Why are we use RECURSION in programing?

I'm now solving some problem related to recursion.

10th Oct 2020, 1:04 PM
meherDev
meherDev - avatar
23 Respuestas
+ 13
A 'recursive' function is a function that calls itself, either directly or indirectly. Recursion is a powerful technique in which a problem is divided into a set of similar subproblems, each solved with a trivial solution. **Generally, a recursive function calls itself to solve its subproblems.
11th Oct 2020, 1:53 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 5
For some problems, a recursive solution is more 'natural' and succinct.
11th Oct 2020, 1:38 PM
Sonic
Sonic - avatar
+ 5
Shail Murtaza in recursion you call the same function and not a parent function.
11th Oct 2020, 1:39 PM
Sonic
Sonic - avatar
+ 4
Meher Ali OK. Factorials and Fibonacci sequences are examples.
11th Oct 2020, 1:45 PM
Sonic
Sonic - avatar
+ 3
Recursion is used to call a function itself again and again But you can do same thing by loops and recursion is not good practice because if you recure your function many times at some point it absolutely will give you error because of memory issue
11th Oct 2020, 11:04 AM
🌀 Shail Murtaza شعیل مرتضیٰ
🌀 Shail Murtaza شعیل مرتضیٰ - avatar
+ 3
Keshav Kumar some problems are better solved iteratively and some solved better recursively.
11th Oct 2020, 9:43 PM
Sonic
Sonic - avatar
+ 2
To understand better how a fonction can call itself or other inner function for infinite or limited time.This can cause great problem in c coding and crash the program or may be the entire system you code in.It is so dangerous to deal with function in c and require more attention.
10th Oct 2020, 1:56 PM
HBhZ_C
HBhZ_C - avatar
+ 2
The classic example is the Fibonacci series 0 1 1 2 3 5 8 13.... Term n+1= Term n + Term n-1 where n>=1.... The first two terms are hard coded... 🔁 Recursion is the key 🗝 here 🤔
10th Oct 2020, 4:00 PM
Sanjay Kamath
Sanjay Kamath - avatar
+ 2
for sorting techniques recursion is very helpful
11th Oct 2020, 4:25 AM
~aalia khan
~aalia khan - avatar
+ 2
For reparation of a function without using any loop
11th Oct 2020, 4:25 AM
Aditya rout
Aditya rout - avatar
+ 2
Recursion is the process of repeating items in a self-similar way. In programming languages, if a program allows you to call a function inside the same function, then it is called a recursive call of the function. Check out this link... https://www.tutorialspoint.com/cprogramming/c_recursion.htm#:~:text=Recursion%20is%20the%20process%20of,int%20main()%20%7B%20recursion()%3B%20%7D
11th Oct 2020, 11:05 AM
Siriki Lohit
+ 2
Danijel Ivanović i think iterative approach is better
11th Oct 2020, 5:53 PM
‎Keshav
‎Keshav - avatar
+ 2
For example if you want to Silvester 5! int x; scanf("%d",&x); for(i=x;i>1;i--){ x=x*i; }
12th Oct 2020, 4:39 AM
Raihaneka
+ 2
A recursive algorithm - a method calling by itself - allows an elegant solution for a problem with often an easier way.
12th Oct 2020, 11:10 AM
JaScript
JaScript - avatar
+ 1
Sonic dude, I wll practice more and more with recursion. Thank you so much
11th Oct 2020, 1:43 PM
meherDev
meherDev - avatar
+ 1
recursion is method of solving the problem where the solution depends on smaller instances of the the same solution.the power of recursion shows the possibility of defining infinite set of objects by a finite statement
11th Oct 2020, 2:04 PM
Aditya rout
Aditya rout - avatar
+ 1
For me, you should use recursion when there are multiple path(or choices) are there in you problem statement and it would be ambiguous to solve it iteratively.
12th Oct 2020, 11:21 AM
Rohit Yadav
Rohit Yadav - avatar
0
Erialdo Meta 🇦🇱 i asked this question because I think, if we use RECURSION then memory consumption is high. Is it right or wrong. Dude you tell me how many recursion problems have you been solved??? If you know well then couldn't put this type of answer. Hope you understand well. If you don't like then better to don't answering.
10th Oct 2020, 2:01 PM
meherDev
meherDev - avatar
0
Erialdo Meta 🇦🇱 dude i have learned my first programing language since when i was in degree(class 13th). So i have been lots of doubt and no body could clear so... I think, you are the master in programming and algo solving. Isn't it???
10th Oct 2020, 2:18 PM
meherDev
meherDev - avatar