sorting

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const Threshold = 200

Threshold defines the threshold at which the algorithm switches to partition in parallel/concurrent mode

Variables

This section is empty.

Functions

func Quicksort

func Quicksort[T comparable](arr []T, cmp func(v, pivot T) bool)

Quicksort sorts the given array using the quicksort algorithm in concurrent/parallel mode, in-place.

best | worst | avg | effective
time 0(nlog(n)) |  0(n^2) | 0(nlog(n))
space 0(log(n)) | 0(1) | 0(log(n))
effective space 0(nlog(n)) avg | 0(log(n) + sqrt(n)) - due to concurrency overhead

func QuicksortASC

func QuicksortASC[T c.Ordered](arr []T)

QuicksortASC invokes Quicksort in ascending order

func QuicksortDESC

func QuicksortDESC[T c.Ordered](arr []T)

QuicksortDESC invokes Quicksort in descending order

Types

This section is empty.

Jump to

Keyboard shortcuts

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