Back

Solution: 2017 Winter Final - 9

Author: Michiel Smid

Question

Consider the recursive algorithm $\Hello$, which takes as input an integer $n \geq 0$: (see file for missing code) If we run algorithm $\Hello(7)$, how many times is the word "hello" printed?
(a)
12
(b)
9
(c)
10
(d)
11

Solution

Draw the treeeeeee

image

The word \enquote{hello} is printed 11 times