AVL树本质上还是一棵二叉搜索树,它的特点是:
本身首先是一棵二叉搜索树。
带有平衡条件:每个结点的左右子树的高度之差的绝对值(平衡因子)最多为1
#include
using namespace std;
const int LH = 1;
const int EH = 0;
const int RH = -1;
bool TRUE = 1;
bool F...
分类:
其他好文 时间:
2014-09-02 17:46:25
阅读次数:
176
char p[];char *p;char *p=new char[];#include using namespace std;const int n=20;int main(){ char p[]="hello world"; //correct //char *p2="...
分类:
其他好文 时间:
2014-09-02 17:38:35
阅读次数:
208
下面我们看一个Override的Example namespace MyCollection{ public class MyBase { public virtual string Meth1() { return "MyBase-Meth1"; } public virtual string M...
分类:
其他好文 时间:
2014-09-02 17:37:45
阅读次数:
284
一 int转string第一种方法:#include #include using namespace std;int main(){ int n = 65535; char t[256]; string s; sprintf(t, "%d", n); s = t; cout #include...
分类:
其他好文 时间:
2014-09-02 17:30:44
阅读次数:
279
简单的矩阵构造题,参看我前几篇的谈到的矩阵的构造法。#include #include #include #include using namespace std;int Mod;struct Matrax { int m[15][15];};Matrax a,per;int ats[15],an[...
分类:
其他好文 时间:
2014-09-02 17:24:34
阅读次数:
208
可以利用DP的思想来做,不过是在DP时加上了矩阵乘法的思想而已,但乘法不是真的乘法,而是mp[a][i]+mp[i][b]I=0的话,则会一直不动,所以要初始化到I->I=INF;#include #include #include using namespace std;const int inf...
分类:
其他好文 时间:
2014-09-02 17:24:24
阅读次数:
137
//链栈的实现 --大话数据结构99页#include using namespace std;//链节点定义typedef struct stacknode{ int data; struct stacknode * next;}StackNode, *LinkStackptr;//...
分类:
其他好文 时间:
2014-09-02 17:14:35
阅读次数:
262
UVA 11374 - Airport Express
题目链接
题意:给定一些经济线,和一些商务线,商务线最多坐一次,每个线有一个时间,问最短时间
思路:从起点,终点各做一次dijstra,然后枚举商务线,就可以算出总时间,最后求出总时间最少
代码:
#include
#include
#include
#include
using namespace st...
分类:
Web程序 时间:
2014-09-02 15:58:35
阅读次数:
253
http://202.197.224.59/OnlineJudge2/index.php/Problem/read/id/1185
判断 x3+y3 = c 是否存在正整数解,2≤c≤109
首先把给定范围内的所有情况打表用数组保存,然后直接二分查找c即可。
#include
#include
using namespace std;
int cnt,a[1010000];
bool fin...
分类:
其他好文 时间:
2014-09-02 15:52:14
阅读次数:
248
//问最少置换多少次变成有序序列
//每个位置都有个循环节 求全部位置循环节的最小公倍数
# include
# include
# include
using namespace std;
int gcd(int x,int y)
{
if(y==0)
return x;
return gcd(y,x%y);
}
int lcm(int x,int y)
{...
分类:
其他好文 时间:
2014-09-02 15:51:04
阅读次数:
223