
数据结构
F_unbelievable
转IT+ing
展开
-
2021-08-10
红黑树的代码实现,实现了红黑树的查找和插入,删除比较复杂后面弄 以下为C++代码,后面有解析。主要是选择操作和情况判断 #pragma once #include <iostream> #include "main_avl.hpp" //单独跑该程序,可以注释这行,rbtree() 改成main去掉 inline即可 constexpr auto black = 0; constexpr auto red = 1; constexpr auto left_uncle = 0; const原创 2021-08-10 11:02:45 · 115 阅读 · 1 评论 -
2021-08-06
C++实现AVl自平衡数 可以正常的添加、删除、查找节点。测试通过 老旧的编译器需要吧nullptr换成NULL #include <iostream> #include <stack> #include <cmath> using namespace std; int max(int a, int b) { if (a >= b) return a; else return b; } // acl_node 的树的原创 2021-08-06 18:20:29 · 99 阅读 · 0 评论