摘要: 代码 func bubblingSort() { numSlice := []int{100, 32, 56, 2, 12, 64, 76} fmt.Println("1 numSlice is", numSlice) //1 numSlice is [100 32 56 2 12 64 76] f 阅读全文
posted @ 2021-12-16 16:44 张永峰z 阅读(40) 评论(0) 推荐(0) 编辑
摘要: 代码 package queue import "fmt" type Queue struct { Array []int Head int Rear int Capacity int } func NewQueue(capacity int) *Queue { return &Queue{ Hea 阅读全文
posted @ 2021-12-16 16:34 张永峰z 阅读(326) 评论(0) 推荐(0) 编辑
摘要: 代码 package pubsub import ( "sync" "time" ) type ( subscriber chan interface{} // 订阅者管道 topicFunc func(v interface{}) bool // 主题过滤器 ) // 发布者对象 type Pub 阅读全文
posted @ 2021-12-16 16:33 张永峰z 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 代码 package calc import "fmt" type Number struct { Val int } const ( testConst1 = iota testConst2 testConst3 ) // 定义要使用的方法 type funcTest func(n int) *N 阅读全文
posted @ 2021-12-16 16:32 张永峰z 阅读(58) 评论(0) 推荐(0) 编辑
摘要: 代码 func QuickSort(arr []int) []int { if len(arr) <= 1 { return arr } splitData := arr[0] //第一个数据 low := make([]int, 0, 0) //比我小的数据 height := make([]in 阅读全文
posted @ 2021-12-16 16:27 张永峰z 阅读(160) 评论(0) 推荐(0) 编辑