随笔分类 - STL
摘要:改造红黑树 目录改造红黑树适配STL迭代器的红黑树基本结构RBTreeNode__RBTree_iteratorRBTree完整代码封装的set封装的map 在初次看STL中实现红黑树的源码时有些不理解,然后自己尝试对set以RBTree<K,K>的方式封装红黑树的迭代器;实现过程发现,这样封装复用
阅读全文
摘要:目录红黑树简述性质/规则主要规则:推导性质:红黑树的基本实现struct RBTreeNodeclass RBTree红黑树的插入红黑树插入修正前言什么时候需要变色:变色的基础:为什么需要旋转与变色变色:旋转需要修正的所有情况(以左为例)先认识最简单的情况1. 叔叔是红色结点注意:2.没有叔叔结点3
阅读全文
摘要:目录基本概念关联式容器键值对树形结构的关联式容器set描述set的使用map描述map的使用multiset描述multiset简单使用multimap描述底层结构 基本概念 关联式容器 在初阶阶段,我们已经接触过STL中的部分容器,比如:vector、list、deque、 forward_lis
阅读全文
摘要:4种旋转操方法,6种双旋平衡因子特征,图文详解,一把到位
阅读全文
摘要:目录二叉搜索树基本概念常用结论用途二叉搜索树的性能分析二叉搜索树的操作查找插入删除代码实现BSTree.hpptest.cc 二叉搜索树 基本概念 二叉搜索树(BST,Binary Search Tree) 二叉搜索树又称二叉排序树,它或者是一棵空树,或者是具有以下性质的二叉树: 若它的左子树不为空
阅读全文
摘要:目录输入/输出操纵符简单示例输入操纵符(Input Manipulators)输出操纵符(Output Manipulators)组合使用 输入/输出操纵符 输入输出操纵符是 C++ 中用于控制输入输出流格式的一组特殊函数或对象。它们通常用于格式化输出,例如设置宽度、精度、对齐方式等,而不涉及数据的
阅读全文
摘要:算法库 -堆操作 基本操作 make_heap() (1)从一个元素范围创建出一个最大堆 (2)将区间内的元素转化为heap.--传比较器 push_heap() 对heap增加一个元素.将一个元素加入到一个最大堆 pop_heap() 对heap取出下一个元素.从最大堆中移除最大元素 sort_h
阅读全文
摘要:#include<time.h> #include<string> #include<vector> #include<iostream> using std::cout; using std::endl; using std::string; namespace test { /**位图概念 *
阅读全文
摘要:set #include"26RBT_container.h" namespace test { //set通过普通迭代器使用const迭代器实现限制key不能被修改 template<class K> class set { private: struct setKeyOfT//命名? 返回RBT
阅读全文
摘要:#pragma once #include<assert.h> #include<iostream> using std::cout; using std::endl; using std::cin; using std::pair; using std::make_pair; using std:
阅读全文
摘要:#pragma once #include<vector> #include<string> #include<iostream> using std::cout; using std::endl; using std::pair; using std::make_pair; namespace H
阅读全文
摘要:unordered_set #pragma once #include"28hashtable_container.h" namespace test { //template < // class Key, // unordered_set::key_type/value_type // clas
阅读全文
摘要:#include<deque> //测试用 #include<vector>//测试用 #include"9Date.h"//测试用 #include<iostream> using std::cout; using std::endl; using std::cin; namespace test
阅读全文
摘要:#include<list> #include<assert.h> #include<deque> #include<iostream> using std::cout; using std::endl; using std::cin; namespace test { //template<cla
阅读全文
摘要:#pragma once #include<assert.h> #include<list> #include<vector> #include<deque> #include<iostream> using std::cout; using std::endl; using std::cin; n
阅读全文
摘要:#pragma once #include"16my_Itetator.h" //测试用 #include<iostream> //测试用 using std::cout; using std::endl; using std::cin; namespace test { //struct默认权限是
阅读全文
摘要:#pragma once #include<assert.h> #include<iostream> using std::cout; using std::endl; using std::cin; namespace test { //#include<algorithm> //模板参数省略:1
阅读全文
摘要:1 #pragma once 2 3 #include<iostream> 4 #include<string.h> 5 #include<assert.h> 6 using std::cout; 7 using std::endl; 8 using std::cin; 9 namespace te
阅读全文