Recursion and its advantages

What is recursion

Recursion is the process of a function calling itself repeatedly till the given condition is satisfied. A function that calls itself directly or indirectly is called a recursive function and such kind of function calls are …


This content originally appeared on DEV Community and was authored by Shubham Kumar

What is recursion

Recursion is the process of a function calling itself repeatedly till the given condition is satisfied. A function that calls itself directly or indirectly is called a recursive function and such kind of function calls are called recursive calls.

In computing, recursion provides powerful alternative for performing repetitive tasks. In fact, few programming languages do not explicitly support looping constructs instead rely on recursion.

In depth recursion means when you call a function by its name for the time then the function call its name inside its definition to perform repetitive task similar as loop until the condition is true, for using recursion we should know the starting and end point of the task or operation.

Image description

Recursive Functions in C
In C, a function that calls itself is called Recursive Function. The recursive functions contain a call to themselves somewhere in the function body. Moreover, a functions can contain multiple recursive calls.

Syntax
type function_name (args) {
// function statements
// base condition
// recursion case (recursive call)
}

this is the basic syntax to perform recursion in function.

Recursion is an important topic in the study of data structure and algorithm


This content originally appeared on DEV Community and was authored by Shubham Kumar


Print Share Comment Cite Upload Translate Updates
APA

Shubham Kumar | Sciencx (2024-08-30T12:12:15+00:00) Recursion and its advantages. Retrieved from https://www.scien.cx/2024/08/30/recursion-and-its-advantages/

MLA
" » Recursion and its advantages." Shubham Kumar | Sciencx - Friday August 30, 2024, https://www.scien.cx/2024/08/30/recursion-and-its-advantages/
HARVARD
Shubham Kumar | Sciencx Friday August 30, 2024 » Recursion and its advantages., viewed ,<https://www.scien.cx/2024/08/30/recursion-and-its-advantages/>
VANCOUVER
Shubham Kumar | Sciencx - » Recursion and its advantages. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/08/30/recursion-and-its-advantages/
CHICAGO
" » Recursion and its advantages." Shubham Kumar | Sciencx - Accessed . https://www.scien.cx/2024/08/30/recursion-and-its-advantages/
IEEE
" » Recursion and its advantages." Shubham Kumar | Sciencx [Online]. Available: https://www.scien.cx/2024/08/30/recursion-and-its-advantages/. [Accessed: ]
rf:citation
» Recursion and its advantages | Shubham Kumar | Sciencx | https://www.scien.cx/2024/08/30/recursion-and-its-advantages/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.