Question 1
doSomething is a procedure that accepts a list of integers as input.
S = doSomething(L)Procedure doSomething(L) if (length(L) ≤ 1) { return(0) } else { return(last(L)-first(L) + doSomething(rest(init(L)))) }End doSomethingBased on the above data, answer the given subquestions.
What will be the value of S at the end of execution when L = [3, 2, 1, 0, 1, 2, 3]?
0
1
12
Error in the pseudocode