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? f(1) = 1, f(2) = 2, f(n) = f(n -3) + f(n - 2); n > 2 f(1) = 1, f(2) = 2, f(n) = f(n -3) f(n - 2); n > 2 f(1) = 1, f(2) = 2, f(n) = 2f(n -1) + f(n - 2); n > 2 f(1) = 1, f(2) = 2, f(n) = 2f(n -1) f(n - 2); n > 2
@UnkleRhaukus
powers of two right?
yea (:
we can't know f(n-3) for n=3 because we dont have f(0)
lets check that last option f(1) = 1, f(2) = 2, f(3) = 2f(3 -1) f(3 - 2) = ? does this equal 4? f(4) = 2f(4 -1) f(4 - 2) = ? does this equal 16?
the first one no it does not aand the second one does
f(3) = 2f(3 -1) f(3 - 2) = 2f(2) f(1) = 2 x 2 x 1 = ?
4 i think
yeah so that fits the table
f(4) = 2f(4 -1) f(4 - 2) = 2f(3) f(2) = 2 x 4 x 2 = ?
16
good, lets check then next term f(5) = 2f(5 -1) f(5 - 2) = ?
13 i think i may of got that wrong
im not sure tht one but for a crazy answer im going to say 128 is the answer
f(5) = 2f(4) f(3) = ?
4096
wait no its its 7 right?
we just found f(4)=16 and f(3) =4
oh ok
so f(4) = 16 and f(3)= 4 then i would add 16 and 4 together then i would get 20 is tht correct ?
if we are testing the fourth option f(n) = 2f(n -1) f(n - 2) you have to multiply the terms (not add)
omg im srry i meant mutiply not add i would get 64
yeah f(5) = 2f(4) f(3) = 2 x 16 x 4 = 2 x 64 =
128
is that the same as f(5) of the table?
yea
goody, what about f(6) ?
yup its 4096
so we have checked the last option and all the points fit,
If we had tried the third option f(1) = 1, f(2) = 2, f(n) = 2f(n -1) + f(n - 2); n > 2 f(3) = 2f(3 -1) + f(3 - 2) = 2 f(2) + f(1) = 2 x 2 + 1 = 5 we see if dosen't match up with the table
oh ok so im a little confused tho im looking at my choices of wat the answer could be but its like its not matching
oh wow wait never mine it is the last option im srry im a little air headed today :/
we tried the last option, with f(n) = 2f(n -1) f(n - 2); n > 2 first, and all the points matched the ones on the table
ik but i submitted it and it was the was the last one was correct :D:D
Join our real-time social learning platform and learn together with your friends!