摘要: #include #include//中序建立二叉树 typedef struct node { struct node *left,*right; int data; int rTag,lTag; }BNode; BNode* pre=NULL;//pre总是指向其前一个结点 BNode* CreateBTree() { int data, front=1, ... 阅读全文
posted @ 2019-05-19 21:48 AQhhhhh 阅读(649) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 typedef struct node 4 { 5 int data; 6 struct node *l,*r; 7 8 }tree; 9 tree* Creattree(void)//层次建立二叉树 10 { 11 int data,front=1,rear=0; 12 tree*... 阅读全文
posted @ 2019-05-10 16:44 AQhhhhh 阅读(3247) 评论(0) 推荐(0) 编辑
摘要: 二叉树的顺序存储是指用一组地址连续的存储单元依次自上而下、自左向右存储完全二叉树上的结点元素 1 #include 2 #include 3 typedef struct btree 4 { 5 int data; 6 struct btree *right,*left; 7 8 }tree; 9 int s[1001],n; 10 void build... 阅读全文
posted @ 2019-05-10 16:03 AQhhhhh 阅读(2093) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 typedef struct node{ 4 int number; 5 struct node * next; 6 }node; 7 node * initLink(int n){ 8 node * head=(node*)malloc(sizeof(node)); 9 head->numb... 阅读全文
posted @ 2019-04-05 20:22 AQhhhhh 阅读(486) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 int map[1005][1005],vis[1005],dis[1005],min,n,m; 3 #define max 0x3f3f3f3f//这里表示无穷大,注意如果调用limits.h里面的INT_MAX,他会把这个当2147483647算; 4 void Dijkstra(int x)//这里用迪杰斯特拉算法做最短路径; 5 { 6 ... 阅读全文
posted @ 2019-03-25 20:59 AQhhhhh 阅读(258) 评论(0) 推荐(0) 编辑
摘要: 这里是有头结点的链表创建: 阅读全文
posted @ 2019-03-08 20:21 AQhhhhh 阅读(1030) 评论(0) 推荐(0) 编辑
摘要: 2019-03-07 1 #include 2 using namespace std; 3 #define max 0x3f3f3f3f//无穷大; 4 int tre[30][30],val[30],vis[30],n; 5 void prim()//本算法是采用prim来写最小生成树的,当然还有其他算法; 6 { 7 int v,min; 8 for(int i=... 阅读全文
posted @ 2019-03-07 21:17 AQhhhhh 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 简单的代码,希望大家加以指点一二 #include <bits/stdc++.h>using namespace std;int main(){ char k[26],c; int i; for(i='a'; i<='z';i++) cin>>k[i]; getchar(); while((c=ge 阅读全文
posted @ 2019-02-13 16:34 AQhhhhh 阅读(125) 评论(0) 推荐(0) 编辑