Boxed-Width Version (true/false)

Selasa, 22 November 2022

thumbnail

Menyelesaikan Deret Fibonancci algoritma tanpa rekursif- JavaScript

Solving the Fibonacci Algo | Without Recursion 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233 …….. In mathematical terms, the nth term of the Fibonacci series can be represented as: tn = tn-1 + tn-2 The Problem Write a function that takes an integer( number )and returns the index value of the Fibonacci sequence Understand the Problem Looking at the sequence below, adding a number to it’s previous give us a sum, which is the following number ( 1 + 1 = 2) next (1 + 2 = 3) next (2 + 3 = 5 )…etc. 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233 ... Solution Output / Testing Big O notation If you noticed I used the While loop instead of Recursion solution paying attention to the Big O complexity While Loop Time complexity: O(N) Space complexity: Constant Time needed: 0.000001ms Recursion Time complexity: O(2^N) Space complexity: O(n) Time needed: 176.742ms resource: medium

Subscribe by Email

Follow Updates Articles from This Blog via Email

No Comments

About

Diberdayakan oleh Blogger.

Featured

advertise here

Cari Blog Ini

Fans Page

Unordered List

Fanspage

Most Recent Post

    Advertise Here

    banner

    Sample Text

    Text Widget

    Formulir Kontak

    Nama

    Email *

    Pesan *

    About Us

    About Us
    There are many variations of passages of Lorem Ipsum available.

    Ethereum Price

    Monday Tuesday Wednesday
    $402.89 $384.06 $396.34

    Facebook