Header Ads Widget

Ticker

6/recent/ticker-posts

Recursion in c.

what is recursion:-

   In programming language whenever any function calls itself then such call are called recursive calls and this phenomena is called recursion.

Example:-

Here in this example function f() is calling itself so it is a recursive call.



There are two types of recursion based on whether function directly calls itself or it is called via some other function.

(1). Direct recursion :-    In direct recursion the recursion call to the function is directly written inside the body of the function.





(2). Indirect recursion :--  
                                                
In Indirect recursion the recursive Call to the function is not directly written inside the body of the function rather this Call lies inside some other function which is invoked (called) from the base function. The Indirect recursion is show at below.


Here f1 function is called by base function f and the recursive call to function f lies in the body of the function f1.

Recommended Post:

Key points:-

Cracking the coding interview:-

 Array and string:-

Tree and graph:-

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-

 MCQs:-






Post a Comment

0 Comments