注意:这篇文章上次更新于1579天前,文章内容可能已经过时。
This article was last updated1579 days ago, the content may be outdated.
写一些刷题常用数据结构
Some common data structures used in problem solving
1 | struct ListNode{ |
1 | struct TreeNode{ |
1 | class UF{ |
可以求无向图中连通分量的个数
Kruskal 最小生成树算法
有一些 DFS 的算法也可以用并查集解决
Can count the number of connected components in an undirected graph
Kruskal’s minimum spanning tree algorithm
Some DFS algorithms can also be solved with union-find
1 | struct Node{ |
Trie (Prefix Tree)
In this example the child nodes are 26 lowercase letters, which is the case for most LeetCode problems.
1 | struct TreeNode{ |
未完待续…
To be continued…


