3 ms·
What if there are recursive function calls?
by jkaptur 6y ago
What if there are recursive function calls?
- pmiller2 6y agoThen you get to have fun solving a recurrence relation. :-)
- johndough 6y agoIf you don't like "fun", WolframAlpha can solve those for you. :-) https://www.wolframalpha.com/input/?i=f%281%29+%3D+1%2C+f%282%29+%3D+1%2C+f%28n%29+%3D+f%28n+-+1%29+%2B+f%28n+-+2%29 https://www.wolframalpha.com/input/?i=f%281%29+%3D+1%2C+f%28...
- pmiller2 6y agoSure, but if you're not on the spot in an interview, the master theorem is simple enough to apply: https://en.wikipedia.org/wiki/Master_theorem_(analysis_of_algorithms)#Generic_form https://en.wikipedia.org/wiki/Master_theorem_(analysis_of_al...
- commandnotfound 6y agoThank you, but for the link provided it only says that these are the Fibonacci numbers and nothing more. Yes, you can click on this F(n) (how can you even know this is a link), but anyways.
- miguelrochefort 6y agobranchesᵈᵉᵖᵗʰ