Files
Data-Structure/BinaryTree/BalanceTree/Red-Black Tree/main.cpp
2025-08-25 16:26:11 +08:00

21 lines
302 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "RBTree.h"
using namespace std;
int main() {
RBTree<int> t;
//一定关注NIL指针的使用所有悬挂出的节点都要用NIL
t.insert(8);
t.insert(5);
t.insert(3);
t.insert(2);
t.insert(7);
t.insert(1);
t.inorder();
cout << endl;
t.erase(7);
t.inorder();
return 0;
}
/*
1 2 3 5 7 8
1 2 3 5 8
*/