Discrete Math briefly explainSolutionPost one more question

Discrete Math, briefly explain.

Solution

Post one more question to get the answer to the part 2

1) Since n is not equal to 0 or 1

FIB(7) will call FIB(6) + FIB(5)

Now FIB(6) will be calculated and FIB(5) will be calculated

(FIB(5) + FIB(4)) + (FIB(4) + FIB(3))

((FIB(4) + FIB(3) + FIB(3) + FIB(2)) + ((FIB(3) + FIB(2) + FIB(2) + FIB(1))

((FIB(3) + FIB(2) + FIB(2) + FIB(1) + FIB(2) + FIB(1) + FIB(1) + FIB(0)) + ((FIB(2) + FIB(1) + FIB(1) + FIB(0) + FIB(1) + FIB(0) + 1)

Hence the number of time the FIB function will be called is equal to

1 + 2 + 1 + 1 => 5

Hence correct answer is Option B

Discrete Math, briefly explain.SolutionPost one more question to get the answer to the part 2 1) Since n is not equal to 0 or 1 FIB(7) will call FIB(6) + FIB(5)

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site