Last active
November 28, 2019 19:15
-
-
Save csmr/6ed62ed1473b776cd73f281b4d225e3d to your computer and use it in GitHub Desktop.
Initial fibonacci fn draft
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// fibo with memoization | |
spiralVertices = function ( args ) { | |
let fibmemo = [] | |
function fibocas ( n, fibmemo ) { | |
fibmemo = fibmemo || {} | |
if (n < 1) return fm 0 // magik num | |
if (n < 2) return fm 1 | |
if (fibmemo[n]) return fibmemo[n] | |
return fibmemo[n] = fibocas ( n-1, fibmemo ) + fibocas ( n-2, fibmemo ) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment