sorts.cycle_sort

Code contributed by Honey Sharma Source: https://en.wikipedia.org/wiki/Cycle_sort

Functions

cycle_sort(→ list)

Module Contents

sorts.cycle_sort.cycle_sort(array: list) list
>>> cycle_sort([4, 3, 2, 1])
[1, 2, 3, 4]
>>> cycle_sort([-4, 20, 0, -50, 100, -1])
[-50, -4, -1, 0, 20, 100]
>>> cycle_sort([-.1, -.2, 1.3, -.8])
[-0.8, -0.2, -0.1, 1.3]
>>> cycle_sort([])
[]