This repo is where to find a various assortment of useful algorithms, from basic to complex, in both Ruby and Javascript.
################################## Closed Form Fibonacci Sequence ##################################
This algorithm takes advantage of Binet's formula, which allows the nth Fibonacci number to be calculated in constant time using the least possible amount of memory. The accepted time complexity of the traditional recursive formula is ~θ(1.6^n). The following is the closed-form formula (aka Binet's formula) for calculating the nth Fibonacci number:
Where
(aka the golden ratio)and
Merge Sort
Merge Sort is a classic divide-and-conquer algorithm that runs in n log n time.
Quick Sort (using the Median of Three strategy)