hunterhug / goa.c Goto Github PK
View Code? Open in Web Editor NEW📚 数据结构和算法(Golang实现)
Home Page: https://hunterhug.gitlab.io/goa.c
License: Apache License 2.0
📚 数据结构和算法(Golang实现)
Home Page: https://hunterhug.gitlab.io/goa.c
License: Apache License 2.0
hello,
The official website address has changed from golang.org to go.dev
https://hunterhug.github.io/goa.c/#/
Description
“内置的数据类型切片 slice 和字典 map 都是引用类型,不需要任何额外操作,所以传递这两种类型作为函数参数,是比较危险的,开发的时候需要谨慎操作。”
这个地方貌似表达有问题,只有map在传参的时候是传地址,其他都是值拷贝,包括slice
https://hunterhug.github.io/goa.c/#/golang/logic
Description
https://hunterhug.github.io/goa.c/#/basic/p
Description
https://hunterhug.github.io/goa.c/#/golang/basic
Description
https://hunterhug.github.io/goa.c/#/basic/dregee
Description
由于我写文章之前都是先实现代码,然后代码有时候很长,要调试。
所以写文章的时候分析代码片段,有些细节就没考虑到,如果发现哪里不理解,或者细节不够,欢迎大家补充文档,比如将代码片段进一步拆细,或者可以补充一些知识如附录,说明,小故事,历史,以及图片啥的都可以(有些图我自己手画的)。
我很乐意合并大家的PR。
帮助更多人既学习Golang,又学习数据结构,是比介绍编程语言本身更有价值。
欢迎大家勘误。
https://hunterhug.github.io/goa.c/#/doc/book
Description
https://hunterhug.github.io/goa.c/#/basic/before
Description
在<包、变量和函数>章节,"go mod int"处, int应为init
https://hunterhug.github.io/goa.c/#/golang/lib
Description
package main
import (
"fmt"
)
type LinkNode struct {
Data int64
NextNode *LinkNode
}
func main() {
// 新的节点
node := new(LinkNode)
node.Data = 2
// 新的节点
node1 := new(LinkNode)
node1.Data = 3
node.NextNode = node1 // node1 链接到 node 节点上
// 新的节点
node2 := new(LinkNode)
node2.Data = 4
node1.NextNode = node2 // node2 链接到 node1 节点上
// 按顺序打印数据
nowNode := node
for nowNode != nil {
// 打印节点值
fmt.Println(nowNode.Data)
// 获取下一个节点
nowNode = nowNode.NextNode
}
// 如果下一个节点为空,表示链表结束了
}
这样才会输出
2
3
4
不知道是不是作者忘记了,优先队列及堆排序的内容没有哦
https://hunterhug.github.io/goa.c/#/doc/install
Description
https://hunterhug.github.io/goa.c/#/README
Description
https://hunterhug.github.io/goa.c/#/basic/refer
Description
https://hunterhug.github.io/goa.c/#/basic/README
Description
https://github.com/hunterhug/gocache/blob/master/README_ZH.md
该库使用了红黑树和最小堆数据结构。利用最小堆堆顶是最老的值,从而快速清洗过期值。可以认为是一个有过期时间的 K-V 本地内存数据库。
原理很简单:
一个 treeMap 用来保存 K-V,一个最小堆的完全树用来清洗过期 key。
官方的 map 不会缩容,treemap 的话不会占用多余空间。
开了个定时器惰性删除过期key,由于定时器每秒最多清除30个过期,可能不够实时,所以当客户端主动拿值时会进行实时删除key,参考的redis。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.