返回顶部
摘要: #include<iostream> #include<cstdio> #include<cstring> #include<queue> using namespace std; const int maxn=100; struct node { int x,y; int step; }S,T, 阅读全文
posted @ 2020-08-11 19:51 tianyudizhua 阅读(139) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<cstdio> #include<queue> using namespace std; const int maxn=100; struct node { int x,y; } Node; int n,m; int matrix[maxn][ 阅读全文
posted @ 2020-08-11 17:10 tianyudizhua 阅读(135) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<vector> #include<cstdio> #include<cstring> using namespace std; const int maxsize=16; int a[maxsize][maxsize]= {0}; bool b 阅读全文
posted @ 2020-08-11 16:18 tianyudizhua 阅读(92) 评论(0) 推荐(0) 编辑
摘要: void simpify(string& x)//去除前导0 { for(string::iterator it=x.begin();it!=x.end();it++) { if(*it=='0') { x.erase(it); cout<<x<<endl; } else break; } } 错误 阅读全文
posted @ 2020-08-08 15:46 tianyudizhua 阅读(144) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<vector> #include<set> #include<string> #include<map> #include<queue> #include<stack> #include<utility> #include<algorithm> 阅读全文
posted @ 2020-08-07 21:47 tianyudizhua 阅读(96) 评论(0) 推荐(0) 编辑
摘要: //先序非递归 void PreOrder2(BiTree T) { InitStack(S); BiTree p=T; while(p||!IsEmpty(S)) { if(p) { visit(p); push(S,p); p=p->lchild; } else { pop(S,p); p=p- 阅读全文
posted @ 2020-08-03 22:30 tianyudizhua 阅读(348) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<string.h> using namespace std; #define MAXLEN 255 //预定义最大串长为255 typedef struct { char ch[MAXLEN]; int length; } SString; t 阅读全文
posted @ 2020-08-01 20:26 tianyudizhua 阅读(146) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> using namespace std; #define N 10 int A[N+1]= {0,-1,89,72,10,-17,20,8,789,45,10}; //A[1]~A[10] typedef struct { //查找表的数据结构 int *ele 阅读全文
posted @ 2020-08-01 16:18 tianyudizhua 阅读(424) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> using namespace std; #define N 10 int A[N+1]= {0,-1,89,72,10,-17,20,8,789,45,10}; //A[1]~A[10] typedef struct { //查找表的数据结构 int *ele 阅读全文
posted @ 2020-08-01 16:03 tianyudizhua 阅读(363) 评论(0) 推荐(0) 编辑
摘要: 直接插入排序 void InsertSort(int A[],int n) { int i,j; for(i=2; i<=n; i++) {//依次将A[2]~A[n]插入到前面已经排序的序列 if(A[i]<A[i-1]) {//若A[i]的关键码小于其前驱,需要将A[i]插入有序表 A[0]=A 阅读全文
posted @ 2020-08-01 15:42 tianyudizhua 阅读(86) 评论(0) 推荐(0) 编辑