Documentation ¶
Index ¶
- func BubbleSort(arr []int)
- func BubbleSortAcc(arr []int)
- func BucketSort(arr []int)
- func CopyArr(originArr []int, maxSize int) []int
- func CountingSort(arr []int)
- func DataComparator(sf sortFunc, benchmarkNum int, maxArrSize int, maxNum int, isAsc bool)
- func GenerateRandomArr(maxSize int, maxNum int) []int
- func HeapSort(arr []int)
- func InsertSort(arr []int)
- func InsertSortSimplify(arr []int)
- func IsEquals(standardArr []int, customizedArr []int) bool
- func MergeSort(arr []int)
- func PrintArr(arr []int)
- func QuickSort(arr []int)
- func QuickSort2(arr []int)
- func RadixSort(arr []int)
- func SelectSort(arr []int)
- func ShellSort(arr []int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BubbleSort ¶
func BubbleSort(arr []int)
func BubbleSortAcc ¶
func BubbleSortAcc(arr []int)
func BucketSort ¶
func BucketSort(arr []int)
func CountingSort ¶
func CountingSort(arr []int)
CountingSort It sorts the elements of an array by counting the number of occurrences of each unique element in the array. The count is stored in an auxiliary array and the sorting si done by mapping the count as an index of the auxiliary array.
1.Find out the maximum element (let ie be maxElement) from the given array. 2.Initialize an array of length as maxElement value + 1 with all elements 0. This array is used for storing the count of the elements in the array. 3.Store the count of each element at their respective index in count array 4.Store cumulative sum of the elements of the count array. It helps in placing the elements into the correct index of the sorted array. 5.Find the index of each element of the original array in the count array. This gives the cumulative count. Place the element at the index calculated. 6.After placing each element at its correct position, decrease its count by one.
func DataComparator ¶
func GenerateRandomArr ¶
func InsertSort ¶
func InsertSort(arr []int)
func InsertSortSimplify ¶
func InsertSortSimplify(arr []int)
func QuickSort2 ¶
func QuickSort2(arr []int)
func SelectSort ¶
func SelectSort(arr []int)
Types ¶
This section is empty.