Jb hum recursion me bare prblm ko chote prblm me break krne ki baat krte h to chota prblm baar baar repeat hota h?
Recursion finding smaller problem and bigger problem
Yes, basically you have a bigger problem, you divide that problem into various small subproblems, and then u keep on repeating this until the base condition is not hit by the code, As soon as any of the basic subproblem can be solved by base condition, you return from the call stack,
aur chote prblm ke repeat hone ki wajh se hi chote prbm wala kaam ek baar hum kr lete h aur baaki ke time isse recursion kr leta h?
yes kind of, for eg, if u have string ABCD, so the subproblem will divide into like A, and then BCD, phir BCD is your new problem, you will break it into B and CD, and then CD will break into C and D, so like this the recursion will work
iss case me chota probm ho gayi pehle letter ko print krna jo ki baar baar repeat ho raha h to iss case me main pehle letter ko ek baar print kr ke recursion call kr dunga aur recursion function ke parameter me string+1 kr dunga h na?
yes, basically u will say ki ABCD mein se A aagya, aur aap yeh assume karoge ki recursion baaki kaam karke aayega for rest of the string…
I get that.
Thank you very much