Smoothsort

Smoothsort is an $$O(n \log n)$$ algorithm, although it is adaptive with a best case of $$O(n)$$. It is not stable, and uses $$O(\log n)$$ memory.

= Explanation = Short version: Heapsort with weirder heaps.

Long version: the rest of this article.

Leonardo Heaps
Leonardo heaps are based on the concept of leonardo numbers. A Leonardo number $$L(n)$$ is defined as follows: $$L(1)$$ and $$L(0)$$ are 1. Otherwise, $$L(n)$$ = $$L(n - 2) + L(n - 1) + 1$$. A Leonardo tree is defined similarly: a tree of order 0 or 1 are single nodes. Otherwise, they are a node with the leonardo tree of the orders n - 1 and n - 2 as children. Leonardo trees must follow the heap property: that is, each node must be larger than its children. Leonardo heaps are a forest of leonardo trees arranged in such a way that the orders of the trees are sorted in descending order (no duplicate orders), and the roots of the trees are sorted in ascending order (that is, the tree woth the largest root must be at the end).