Recursion --Facing Difficulty

hello, I am a beginner in Recursion but I can do easy problems which does not need a recursion tree.
but I am facing difficultly in drawing a recursion tree as well as implementing the code using that recursion tree. please help me as this is one of the major requirement to become good at programming.

1 Like

You reminded me of this. Similar words. :slight_smile:

1 Like

leap of faith will be best… see this articles this helped me a lot

https://www.cs.cmu.edu/~adamchik/15-121/lectures/Recursions/recursions.html#:~:text=Each%20recursive%20definition%20requires%20base%20cases%20in%20order%20to%20prevent%20infinite%20recursion.&text=This%20step%20is%20often%20called,it%20is%20supposed%20to%20do.
just see that your base case is correct no faulty there and during recursion call just belive that function will give u desired output just think…then it will be easy to think…recursively

you can also see this video explained very well

i need something in which for loop is included .i mean any dry run code of hard problem

1 Like

for example see in permutation of string when we draw tree the child nodes depends on the size of the string meaning one call with for loop will be used…and in subsequcne of set using recurion child nodes does not depend on size of set it is either element included or element not included so no loop i think you were talking about this only :grinning:@

@dinesh450 I would suggest you to do this: https://leetcode.com/explore/featured/card/recursion-i/
it will surely help.

1 Like

There is a series to learn recursion. You can study it from there.

1 Like

@anon40522502 @shreyash_sohan @utkarsh1729 thank you so much for giving suggestions today i am able to solve recursive problems due to which most of the ds and algo have become easier.
Thank you for your help guys…

1 Like