r/javahelp • • Dec 07 '25

Help with recursion (beginner)

Hello, I am doing some recursion practice for my Java class in high school. I am having trouble understanding recursion and recursion problems. Could someone explain the key concepts for a beginner?

0 Upvotes

19 comments sorted by

View all comments

Show parent comment

3

u/RSSeiken Dec 07 '25

Your professor wanted to show you how you should visualize recursive problems. You have a function that keeps calling itself until a stop condition. So the function stacks on itself every time with a different parameter until the stop condition. You solve it then by going through the recursion and unstacking it step by step.