monkey_sort

package module
v0.0.0-...-f0ed0bf Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: MIT Imports: 2 Imported by: 0

README

猴子排序(Monkey Sort)

注意:本项目只是一个玩笑性质的项目,所使用的的排序算法也不适合用于生产环境!

一、安装

go get -u github.com/golang-infrastructure/go-monkey-sort

二、示例代码

package main

import (
	"fmt"
	monkey_sort "github.com/golang-infrastructure/go-monkey-sort"
)

func main() {
	slice := []int{2, 3, 1, 4}
	count := monkey_sort.Sort(slice)
	fmt.Println(count)
	fmt.Println(slice)
	// Output:
	// 4861854
	// [1 2 3 4]
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sort

func Sort[T gtypes.Ordered](slice []T) int

Sort 对切片使用猴子排序

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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