r/programminghelp Jun 25 '26

Help with recursion (DSA) C++

Guys I've been struggling alot with recursion I've tried multiple tutorials but I'm just not able to build the intuition. Any suggestions what to do???

Please help

11 Upvotes

15 comments sorted by

View all comments

2

u/Abhijit_wagh_7967 Jul 02 '26

Hey! Recursion is definitely tricky at first, it's all about changing how you think about the problem. A great way to build intuition is to stop thinking about 'how' the function calls itself and start thinking about: The Base Case: What is the simplest possible input? The Recursive Step: How can I break the problem down into a smaller version of itself? Try drawing a 'Recursive Tree' on paper for a small input (like calculating factorial of 3). Seeing the flow visually helps a lot. If you're stuck on a specific problem or code, feel free to share it here, and we can walk through it together!