sort

package
v0.0.3-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package sort a package for demonstrating sorting algorithms in Go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count

func Count(data []int) []int

func Exchange

func Exchange(arr []int) []int

func HeapSort

func HeapSort(slice []int) []int

func ImprovedSimpleSort

func ImprovedSimpleSort(arr []int) []int

ImprovedSimpleSort is a improve SimpleSort by skipping an unnecessary comparison of the first and last. This improved version is more similar to implementation of insertion sort

func InsertionSort

func InsertionSort(arr []int) []int

func Mergesort

func Mergesort(items []int) []int

Mergesort Perform mergesort on a slice of ints

func Pigeonhole

func Pigeonhole(arr []int) []int

Pigeonhole sorts a slice using pigeonhole sorting algorithm.

func QuickSort

func QuickSort(arr []int) []int

QuickSort Sorts the entire array

func QuickSortRange

func QuickSortRange(arr []int, low, high int)

QuickSortRange Sorts the specified range within the array

func RadixSort

func RadixSort(arr []int) []int

func SelectionSort

func SelectionSort(arr []int) []int

func ShellSort

func ShellSort(arr []int) []int

func SimpleSort

func SimpleSort(arr []int) []int

Types

type Comparable

type Comparable interface {
	Idx() int
	More(interface{}) bool
}

type Int

type Int int

func (Int) Idx

func (a Int) Idx() int

func (Int) More

func (a Int) More(b interface{}) bool

type MaxHeap

type MaxHeap struct {
	// contains filtered or unexported fields
}

func (MaxHeap) Heapify

func (h MaxHeap) Heapify()

func (*MaxHeap) Init

func (h *MaxHeap) Init(slice []Comparable)

func (*MaxHeap) Pop

func (h *MaxHeap) Pop() Comparable

func (*MaxHeap) Push

func (h *MaxHeap) Push(i Comparable)

func (MaxHeap) Size

func (h MaxHeap) Size() int

func (MaxHeap) Update

func (h MaxHeap) Update(i Comparable)

Jump to

Keyboard shortcuts

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