ssort

package
v1.3.9 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BubbleSort

func BubbleSort(list []int, cmp func(i, j int) bool)

BubbleSort 冒泡排序 n^2

func InsertSort

func InsertSort(list []int, cmp func(i, j int) bool)

InsertSort 插入排序 n^2

func MergeSort

func MergeSort(nums []int, l, r int)

MergeSort 归并排序 nlogn

func MergeSort2

func MergeSort2(array []int, begin int, end int)

MergeSort2 非递归

func QSort

func QSort(array []int, low, high int, cmp func(a, b int) bool)

QSort 快排 nlogn

func SelectSort

func SelectSort(list []int, cmp func(i, j int) bool)

SelectSort 选择排序 n^2

func ShellSort

func ShellSort(list []int, cmp func(i, j int) bool)

ShellSort 希尔排序

Types

type ListNode

type ListNode struct {
	Val  int
	Next *ListNode
}

func SortList

func SortList(head, tail *ListNode) *ListNode

SortList 给出链表的头节点和最后一个有效节点的下一个节点

Jump to

Keyboard shortcuts

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