随笔分类 -  Golang

Golang学习笔记
摘要:bit数组构建一个非负整数Set集合 实现了下面这些方法: func (s *IntSet) Has(x int) bool //不断集合中是否存在元素x func (s *IntSet) Add(x int) // 添加元素 func (*IntSet) Len() int // return t 阅读全文
posted @ 2025-08-21 16:53 dwhere 阅读(13) 评论(0) 推荐(0)
摘要:Map构建有向图 var graph = make(map[string]map[string]bool) func addEdge(from, to string) { edges := graph[from] if edges == nil { edges = make(map[string]b 阅读全文
posted @ 2025-08-18 16:39 dwhere 阅读(10) 评论(0) 推荐(0)
摘要:二叉树来实现一个插入排序 go 递归 package main import "fmt" type tree struct { value int left, right *tree } func treeSort(values []int) []int { var t *tree for _, v 阅读全文
posted @ 2025-07-17 14:34 dwhere 阅读(17) 评论(0) 推荐(0)