The table below shows the values of f(n) for different values of n: n 1 2 3 4 5 6 f(n) 1 2 4 16 128 4096 Which recursive function best represents the values shown in the table? A) f(1) = 1, f(2) = 2, f(n) = f(n -3) + f(n - 2); n > 2 B) f(1) = 1, f(2) = 2, f(n) = f(n -3) f(n - 2); n > 2 C)f(1) =1, f(2) = 2, f(n) = 2f(n -1) + f(n - 2); n > 2 D) f(1) = 1, f(2) = 2, f(n) = 2f(n -1) f(n - 2); n > 2
please help!
@welshfella can you help with this one?
f(1) means the value of function when n = 1 f(2) when n=2 etc
what you need to do is substitute n = 3 into the formulae for f(n) and see if this gives you f(2) - that is a value of 2.
oh, ok i'll do that really quickly
wait:/ i don't have a formula
sorry - i got that wrong - it should give you the value for f(3) which is 4
yeah
ok lets try the last one
alrighty, what happens first
f(n) = 2f(n -1) f(n - 2); n > 2 f(3) = 2*f(2)*f(1) = 2*2*1 = 4
what do you do from there?
thats the one - we hit the right one
f(3) = 4 - which is the value on the table
oh ok
understand?
yeah, so just to be clear it would be D?
yes we could double check to see if f(4) = 16 f(4) = 2*f(3)*f(2) = 2 * 4 * 2 = ?
does that = 16?
yes:^)
thats itt the D is the correct choice
oh i see, okay thank you @welshfella
yw
Join our real-time social learning platform and learn together with your friends!