sorts.strand_sort

Functions

strand_sort(→ list)

Strand sort implementation

Module Contents

sorts.strand_sort.strand_sort(arr: list, reverse: bool = False, solution: list | None = None) list

Strand sort implementation source: https://en.wikipedia.org/wiki/Strand_sort

Parameters:
  • arr – Unordered input list

  • reverse – Descent ordering flag

  • solution – Ordered items container

Examples: >>> strand_sort([4, 2, 5, 3, 0, 1]) [0, 1, 2, 3, 4, 5]

>>> strand_sort([4, 2, 5, 3, 0, 1], reverse=True)
[5, 4, 3, 2, 1, 0]