Question: 2. [Easyl Trace the following recursion code. Draw and Write down the outputs. Please, show the recursive flow in details to get the full mark.

2. [Easyl Trace the following recursion code. Draw and Write down the outputs. Please, show the recursive flow in details to get the full mark. public class Trace public static void main(String[] args) { System.out.println("Finally " + HMB (5)); publie atatic int hm (int h) if(h) System.out.println("Stop: " + h); return 0; ) olse if(h=-1){ System.out.println("Stop: " + h): return h: ) elset System.out.println("Continue: + h); return h + HMB (h-1); 3 OR class Trace: def HMB (self,h): if (h=0): print("Stop: ", h) return 0 elif (h==1): print("Stop: ", h) return h else: print("Continue: ", h) return h + self.HMB (h-1) #Tester t = Trace() print("Finally ", t.hMB (5))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
