@[inline]
def
Array.insertionSort
{α : Type u_1}
(a : Array α)
(lt : α → α → Bool := by exact (· < ·))
:
Array α
Equations
- a.insertionSort lt = Array.insertionSort.traverse lt a 0 a.size
Instances For
@[specialize #[]]
def
Array.insertionSort.swapLoop
{α : Type u_1}
(lt : α → α → Bool := by exact (· < ·))
(a : Array α)
(j : Nat)
(h : j < a.size)
:
Array α
Equations
- Array.insertionSort.swapLoop lt a 0 h = a
- Array.insertionSort.swapLoop lt a j'.succ h = if lt a[j'.succ] a[j'] = true then Array.insertionSort.swapLoop lt (a.swap j'.succ j' h ⋯) j' ⋯ else a