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.
Click to show internal directories.
Click to hide internal directories.