You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// tail : when a recursive function call itself and that recursive call is the last statement , then it is called as "Tail Recursion".
// Time complexity : O(n);
// Space complexity : O(n);
// tail(3);
// output : 3 2 1
// function head(n){
// if(n > 0 ){
// head(n-1);
// console.log(n);
// }
// }
// head(3);
// output : 1 2 3
// Head recursion : it is a function that doesn't have to perform any operation & process at the time of calling. It has to do all the operations and process at the time of returning so these functions are called "Head recursions";