Dec-02-2020, 06:03 PM
This is the basic structure of your function:
Output:rec_count(5)
print 5
rec_count(4)
print 5
If we expand all calls like that, we get:Output:rec_count(5)
print 5
rec_count(4)
print 4
rec_count(3)
print 3
rec_count(2)
print 2
rec_count(1)
print 1
rec_count(0)
print 0
return 0
print 0 -- not called because the return ends this call
print 1
print 2
print 3
print 4
print 5
Hope that helps.