+ 7
Why are we use RECURSION in programing?
I'm now solving some problem related to recursion.
23 Answers
+ 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.
+ 5
For some problems, a recursive solution is more 'natural' and succinct.
+ 5
Shail Murtaza in recursion you call the same function and not a parent function.
+ 4
Meher Ali OK. Factorials and Fibonacci sequences are examples.
+ 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
+ 3
Keshav Kumar some problems are better solved iteratively and some solved better recursively.
+ 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.
+ 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 🤔
+ 2
for sorting techniques recursion is very helpful
+ 2
For reparation of a function without using any loop
+ 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
+ 2
Danijel Ivanović i think iterative approach is better
+ 2
For example if you want to Silvester
5!
int x;
scanf("%d",&x);
for(i=x;i>1;i--){
x=x*i;
}
+ 2
A recursive algorithm - a method calling by itself - allows an elegant solution for a problem with often an easier way.
+ 1
Sonic dude, I wll practice more and more with recursion.
Thank you so much
+ 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
+ 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.
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.
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???