Skip to content

fabonaci

Posted on:June 16, 2023 at 05:33 AM
fabonacci tail call optimization



// n, n -1 , n-2

//
fun(left, 0) {


    return f(n-1) +f(n-2)



}
fun(n[],  pre =0) {

     pop


     return ()
}

// fabonacci 数列 1,1, 2, 3, 5, 8, 0 1 2 3

===================

fn()

if(m ===1, )

    return f(n-1, current, current + ac)

acc , acc2 ,

acculate