#include int factorial(int num); int main () { std::cout 1){ return num * factorial(num - 1); } else{ return 1; } }
@FrederikWollert7 ай бұрын
Awesome Video. Is it not necessary to have a faster and memory efficient Program in sorting and Searching Algorithm programs?
@Dazza_Doo2 жыл бұрын
To avoid Stack Over flow, could you do this: Half way into Recursion, you then exit the function by passing on the information into a new Function (that does the exact same thing) - I would assume that the STACK would clear itself of the first Recursion and be on it's merry way, then you hand the "Batton" (relay running race) back to the Original function and start the cycle all over again?
@tabibhassan337622 күн бұрын
well you're in a for loop. so the steps will decrease every time. Basically you're iterating but not manually rather calling the main function. (sorry for late answer)
@Tevadaa3 ай бұрын
Thank you bro code ur the goat fr
@wlsedlacek Жыл бұрын
how is the (steps - 1) stopping the result from going into loop? isnt (steps -1) just =99 ?
@masterali2837 Жыл бұрын
well yes then 99 becomes 98 then 97 and soo on until 0 then it does not run the if statement anymore and breaks out of the functions (this is pretty simple to understand im just guessing your first programing experience is with c++ but i recemend python for starting)