Strand Sort

An interactive, step-by-step visualisation of Strand Sort.

Category
Sorting
Time complexity
O(n²) worst
Space complexity
O(n)

Pseudocode

result ← []
while list not empty:
  pull longest increasing strand out
  merge strand into result

Reference implementation

def strand_sort(a):
    result = []
    while a:
        strand = pull_increasing_run(a)
        result = merge(result, strand)
    return result

Open the interactive Strand Sort visualisation →