sorting

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Merge

func Merge[T constraints.Ordered](a, b []T) []T

Merge returns a merged list comprised of two input lists. If the provided lists are sorted, the returned list will be as well.

func MergeSort

func MergeSort[T constraints.Ordered](args ...T) []T

MergeSort returns provided args as a sorted list. If no args are provided, nil is returned. The sort is performed using the Merge Sort algorithm.

func Sort

func Sort[T constraints.Ordered](impl SortImpl, args ...T) []T

Sort returns provided args as a sorted list. If no args are provided, nil is returned. The sort is performed as defined by the provided SortImpl.

TODO: provide a SortCustomComparator function which sorts based on a provided comparison function.

Types

type SortImpl

type SortImpl uint
const (
	MergeImpl SortImpl = iota

	MergeImplEnd // Must always be last
)

Jump to

Keyboard shortcuts

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