- 博客(4)
- 资源 (2)
- 收藏
- 关注
转载 AVL树
AVL树[编辑]非AVL树的例子在计算机科学中,AVL树是最先发明的自平衡二叉查找树。在AVL树中任何节点的两个子树的高度最大差别为一,所以它也被称为高度平衡树。查找、插入和删除在平均和最坏情况下都是O(log n)。增加和删除可能需要通过一次或多次树旋转来重新平衡这个树。AVL树得名于它的发明者G.M. Adelson-Velsky和E
2014-09-05 15:35:49
570
原创 1009 说反话 pat
#include#include #include using namespace std;string FanZhuan(string temp){stack stack;stack.push("&&");string str;int fir = 0, sec = 0;int i = 0;while (true){if ((temp[i
2014-04-14 13:16:57
646
原创 1008 元素右移
#includeusing namespace std;void MoveForward(int *temp, int n){int fir = temp[n-1];for (int i = n-1; i >= 0; i--){temp[i+1] = temp[i];}temp[0] = fir;}int main(){int n, m;
2014-04-13 20:32:08
487
原创 pat 1005 继续(3n+1)猜想
//解题思想:对数列中的每个数进行验证, 如果此数覆盖了其他数,则将其他数置为可覆盖//依次类推#include#include #include #include using namespace std;vector vec;void Panduan(int n){while (n != 1){if (n % 2 == 0){
2014-04-13 19:11:24
594
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人