sort

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeSort added in v0.0.2

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

The time complexity of the merge sort algorithm is O(n*log(n)) in the average and worst cases, where n is the number of elements in the list. Merge sort is considered a stable sorting algorithm, meaning it preserves the relative order of elements with equal values.

func QuickSort

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

Average time complexity O(n*log(n)), where n is the number of elements in the array. However, in the worst-case scenario, the time complexity can degrade to O(n^2) if the pivot selection is not optimal. There are multiple strategies for choosing a pivot - first, last, middle, random, etc.

Types

This section is empty.

Jump to

Keyboard shortcuts

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