摘要: 1 //并查集类 2 #include 3 #include 4 #include 5 6 7 using namespace std; 8 class Fmsets{ 9 vector parent_;10 11 protected:12 in... 阅读全文
posted @ 2015-07-22 17:49 喜欢算法的小杰 阅读(352) 评论(0) 推荐(0) 编辑
摘要: 1.标准初始化函数 std::fill(首地址,尾地址,value) || 用于在首尾地址之间填充value值,对应matlab的ones(1:n)函数1 template 2 void fill (ForwardIterator first, ForwardIterator last, c... 阅读全文
posted @ 2015-07-22 16:23 喜欢算法的小杰 阅读(201) 评论(0) 推荐(0) 编辑
摘要: 1 //一般树的手工打造,遍历,求节点数和树高 2 #include 3 #include 4 #include //使用向量需包含该文件 5 6 using namespace std; 7 8 template 9 struct Tnode{10 11 typedef ... 阅读全文
posted @ 2015-07-22 09:49 喜欢算法的小杰 阅读(184) 评论(0) 推荐(0) 编辑