Two Parts of a Recursive Solution
Recursion
is implemented by defining two scenarios, both of these are marked in the printList
function:
Base case: This is the
non-recursive
case (the part that doesn't trigger another call) and defines when to stop (or the smallest version of the problem).General case / Recursive case: Defines how to solve the problem in terms of a smaller version of itself. Each general case should get you "closer" to the base case.