- 博客(3)
- 收藏
- 关注
原创 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
110
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
96
原创 C++
std::function和std::bind与回调函数回调函数,简单的理解是,类里面有成员可以调用类对象本身(可以理解为this指针)包含知识点(函数指针、重载operator()、*this)1. 不同标题类型可能具有相同的调用形式,如:// 普通函数int add(int a, int b){return a+b;} // lambda表达式auto mod = [](int a, int b){ return a % b;}// 函数对象类struct divide{ in
2021-05-16 21:35:13
394
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人