sort

package module
v0.52.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 1 Imported by: 1

Documentation

Overview

Package sort has sort functions used by Agent.

Index

Constants

View Source
const InsertionSortThreshold = 40

InsertionSortThreshold is the slice size after which we should consider using the stdlib sort method instead of the InsertionSort implemented below.

Variables

This section is empty.

Functions

func InsertionSort

func InsertionSort(elements []string)

InsertionSort sorts in-place the given elements, not doing any allocation. It is very efficient for on slices but if memory allocation is not an issue, consider using the stdlib `sort.Sort` method on slices having a size > InsertionSortThreshold. See `pkg/util/sort_benchmarks_note.md` for more details.

func UniqInPlace

func UniqInPlace(elements []string) []string

UniqInPlace sorts and remove duplicates from elements in place The returned slice is a subslice of elements

Types

This section is empty.

Jump to

Keyboard shortcuts

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