- 博客(2)
- 收藏
- 关注
原创 Disjoint Set
一个可用graph连接表示的array,每个element都代表一个node常用函数:find(x) && union(x,y)find(x) 的功能是找出x所对应的root nodeunion(x,y)的功能是把x和y连在一起,即将y的root node改为x的root nodeQuick Find:把每个element的值设为root node int find(int x) { return root[x]; } void unio
2022-05-04 12:56:26
94
原创 C++ std::map
相关题目: leetcode 13 roman to integer什么时候用到map:当一系列同类型的数据都有某一项property,我们需要用到这个property的时候。当数据量不大的时候,可以用switch代替map会省内存和时间。Java中非常常见的hashmap其实跟c++中的std::unorderedmap一样。但是要区分好std::map和std::unorderedmap。 std::map和std::unorderedmap的construct形式一样:std::
2022-05-04 03:39:53
725
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人