What sequence of numbers would be printed by the followingrecursive procedure if
ID: 3611177 • Letter: W
Question
What sequence of numbers would be printed by the followingrecursive procedure if we started it with N assigned the value1?procedure Exercise(N)
print the value of N;
if (n<3) then (apply the procedure Excersise to thevalue N+1);
print the value of N.
The answer to this given is 1,2,3,3,2,1,..(can u please explain mewhy the numbers are given backwards?, is that because of the copiesthat return back the result to the original copy or somethingelse?
then after that is required what could be the termination conditionin the recursive procedure in the thing above.