sorting

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TestCases = []struct {
	Size int
}{
	{Size: 50000},
	{Size: 100000},
	{Size: 500000},
	{Size: 1000000},
}

Defines the test cases for sorting algorithms, i.e. the input sizes to test

Functions

func BuiltInSort

func BuiltInSort[T cmp.Ordered](slice []T) []T

func GenerateSlice

func GenerateSlice[T cmp.Ordered](size int, generator func(int) T) []T

Generates a slice of length size with elements generated by generator

func HeapSort

func HeapSort[T cmp.Ordered](slice []T) []T

func MaxHeapPop

func MaxHeapPop[T cmp.Ordered](slice []T)

Usage: HeapSort Moves the largest element to the end of the slice and shifts the heap down

func MaxHeapShiftDown

func MaxHeapShiftDown[T cmp.Ordered](slice []T, i, size int)

Usage: HeapSort Shifts the element at index i down the heap until it is in the correct position

func MaxHeapify

func MaxHeapify[T cmp.Ordered](slice []T)

Usage: HeapSort Builds a max heap from the slice

func MergeSlices

func MergeSlices[T cmp.Ordered](left, right []T) []T

Usage: MergeSort, MergeSortParallel Merges two sorted slices into a single sorted slice

func MergeSort

func MergeSort[T cmp.Ordered](slice []T) []T

func ParallelMergeSort

func ParallelMergeSort[T cmp.Ordered](slice []T) []T

func ParallelQuickSort

func ParallelQuickSort[T cmp.Ordered](slice []T) []T

func ParseBenchmark

func ParseBenchmark(name, rawBenchmark string) benchmark.Benchmark

Wrapper around base parsing, adding input size to each test case

func QuickSort

func QuickSort[T cmp.Ordered](slice []T) []T

func RandomIntGenerator

func RandomIntGenerator(max int) func(int) int

Generates a random integer generator that generates integers in the range [0, max)

Types

This section is empty.

Jump to

Keyboard shortcuts

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