sort

package
v0.0.0-...-1e7114d Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2021 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BubbleSort

func BubbleSort(data []int)

func InsertSort

func InsertSort(data []int)

对data进行正向排序 1、从第一个元素开始,该元素可以认为已经被排序; 2、取出下一个元素,在已经排序的元素序列中从后向前扫描; 3、如果该元素(已排序)大于新元素,将该元素移到下一位置; 4、重复步骤 3,直到找到已排序的元素小于或者等于新元素的位置; 5、将新元素插入到该位置后; 6、重复步骤 2~5。 难度系数 O(n^2)

Types

This section is empty.

Jump to

Keyboard shortcuts

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