摘要:
判断是否为红黑树,主要判断子树到叶子节点的路径上黑色的数量是否相等 还需要判断给定的前序遍历是否是二叉搜索树的合法表示,虽然题目没说(pat特色) #include<bits/stdc++.h> using namespace std; typedef long long LL; const int 阅读全文
摘要:
哈希,开放寻址法,平方探测法 插入和查找的过程是等价的,都是判断当前位置是否为空或者k是否超出Msize #include<bits/stdc++.h> using namespace std; const int N = 1e4+10; int Msize,n,m; int h[N]; bool 阅读全文
摘要:
平衡树 avl的板子,跟treap不同的是需要自己判断高度差(四种情况)来实现平衡 #include<bits/stdc++.h> using namespace std; const int N = 30; int idx; struct NODE{ int l,r; int key; int h 阅读全文