sorting

package
v0.0.0-...-3e50352 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const MERGE_CUTOFF = 7

Variables

This section is empty.

Functions

func InsertionSort

func InsertionSort[T misc.Ordered](arr []T)

func InsertionSortImmutable

func InsertionSortImmutable[T misc.Ordered](arr []T) []T

func IsSorted

func IsSorted[T misc.Ordered](arr []T) bool

func MergeSort

func MergeSort[T misc.Ordered](arr []T)

sorting an array using an optimized version of mergesort (top-down)

func MergeSortIndices

func MergeSortIndices[T misc.Ordered](arr []T) []int

ret[i] is the index of the ith smallest entry in arr or: if we sort the array, ret[i] gives the original position for sorted[i]

func QuickSort

func QuickSort[T misc.Ordered](arr []T)

optimized version of quicksort (using Bentley-McIlroy 3-way partitioning, Tukey's ninther, and cutoff to insertion sort)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL