I am having a difficult time figuring out where to start this problem. Any input on where to start would be greatly appreciated.
Consider the recursive algorithm, which operates on a sequence of real numbers, S = {s0, s1, s2, ..., sn):
Function Questo(S)
First := the first element of s
If length(S) is 1
return First
End-if
S1 := S with the first element removed
return first + Questo(S1)
Let sequence T := (4,2,-1,3)
Which value is returned by Questo(T)?
\begin{align} \text{Questo}(T) &= \color{orange}{\text{Questo}(4,2,-1,3)} \\ &= 4 + \color{green}{\text{Questo}(2,-1,3)} \\ &= 4 + 2 + \color{blue}{\text{Questo}(-1,3)} \\ &= 4 + 2 + (-1) + \color{red}{\text{Questo}(3)} \\ &= 4 + 2 + (-1) + \color{red}{3} \\ &= 4 + 2 + \color{blue}{2} \\ &= 4 + \color{green}{4} \\ &= \color{orange}{8} \end{align}