For each of the calls to the following recursive function be…
For each of the calls to the following recursive function below, indicate what value is returned: string mystery6(string s) { if (s.length() == 1) { return “*” + s + “*”; } else if (s.length() % 2 == 0) { string rest = s.substr(1, s.length() – 1); return s[ s.length() – 1 ] + mystery6(rest) + s[ 0 ]; } else { string rest = s.substr(1); return “-” + mystery6(rest); } } mystery6(“hello”) [r1] mystery6(“worlds”) [r2] mystery6(“koala”) [r3]
Read Details