
AVL树
coldfresh
那我们开始吧
展开
-
二叉平衡树(AVL)的插入
这次节点的数据域增加了高度这个量,用来计算平衡因子,以此在插入的时候来调整树的结构 节点:struct node{ int val; int hei; node *l; node *r;};构造新节点node* newNode(int v){ node* Node=new node; Node->val=v; N...原创 2018-03-06 19:14:00 · 252 阅读 · 0 评论 -
(pat)A1135. Is It A Red-Black Tree
There is a kind of balanced binary search tree named red-black tree in the data structure. It has the following 5 properties:(1) Every node is either red or black. (2) The root is black. (3) Every...原创 2018-03-14 19:58:07 · 425 阅读 · 0 评论