@Rishi Srivastava
In mathematics, the Fibonacci numbers form a sequence, the Fibonacci sequence, in which each number is the sum of the two preceding ones. Starting from 0 and 1, the next few values in the sequence are:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144
Formula: F(n) = F(n-1) F(n-2) {for n greater than 1}
Recursive algorithm pseudocode:
function fib(n):
if n is less than 0, then return undefined
if n is less than 2, then return n
return fib(n-1) fib(n-2)
Time complexity: O(2^n)
Space complexity: O(n) if we consider the recursive stack
ERRATA: The total time taken is not 6.7 seconds but the ms given in the output
Github:
1 view
2149
648
1 month ago 00:07:41 1
039 Том и Джерри - Polka-Dot Puss ()
1 month ago 00:00:30 1
[🌀Portal to nostalgia🌀] Реклама КИНДЕР СЮРПРИЗ (2006) - Меджик Спорт
1 month ago 00:11:51 1
Выпуск сертификатов с помощью динамической конфигурации traefik