摘要: #include<bits_stdc++.h> #define max 50 using namespace std; typedef struct bstnode//BST结构 { int data; bstnode *lc; bstnode *rc; }bt,*bst; typedef stru 阅读全文
posted @ 2018-02-12 09:36 夜游星 阅读(484) 评论(0) 推荐(0) 编辑
摘要: #define maxnum 30 #include<bits_stdc++.h> int visited[maxnum]={0}; using namespace std; typedef struct bian//边 { int mark;//标记是否搜索 int ivex,jvex;//两顶点 阅读全文
posted @ 2018-02-12 09:34 夜游星 阅读(525) 评论(0) 推荐(0) 编辑
摘要: 【实验目的】 (1) 深入了解栈和队列的特性,掌握栈和队列的存储方法。 (2) 掌握栈和队列的基本操作,如初始化、入栈(队列)、出栈(队列)等,并能在实际问题背景下灵活运用。 【问题描述】 设停车场是一个可以停放n辆汽车的狭长通道,且只有一个大门可供汽车进出。汽车在停车场内按车辆到达时间的先后顺序, 阅读全文
posted @ 2018-02-12 09:33 夜游星 阅读(454) 评论(0) 推荐(0) 编辑
摘要: #include<iostream.h> #include<stdio.h> #include<stdlib.h> typedef struct node { int data1; int data2; node *next; }list; list *creat(int n)//建立单循环链表 { 阅读全文
posted @ 2018-02-12 09:31 夜游星 阅读(598) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<stdlib.h>using namespace std;typedef struct node{ int data; node *next;}nd;typedef struct stack{ nd *top; int ct;}sta;void 阅读全文
posted @ 2018-02-12 09:24 夜游星 阅读(192) 评论(0) 推荐(0) 编辑
摘要: #include<bits_stdc++.h>using namespace std;typedef struct btnode{ char data; btnode *lc,*rc;}bitn,*btree;void creattree(btree &t){ char c; cin>>c; if( 阅读全文
posted @ 2018-02-12 09:23 夜游星 阅读(156) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<cmath>#include<stdlib.h>#include<algorithm>using namespace std;double f(double x)//函数{ return 2*x;}double simpson(double a, 阅读全文
posted @ 2018-02-12 09:21 夜游星 阅读(272) 评论(0) 推荐(0) 编辑
摘要: #include<bits_stdc++.h>using namespace std;typedef struct //huffmantree node{ int w; int p,lc,rc;}hmnode,hftree;typedef char **hfcode;//编码表void tsort( 阅读全文
posted @ 2018-02-12 09:20 夜游星 阅读(339) 评论(0) 推荐(0) 编辑
摘要: int quick(int a,int b,int c) { int ans=1; //记录结果 a=a%c; //预处理,使得a处于c的数据范围之下 while(b!=0) { if(b&1) ans=(ans*a)%c; //如果b的二进制位不是0,那么我们的结果是要参与运算的 b>>=1; / 阅读全文
posted @ 2018-02-12 09:14 夜游星 阅读(250) 评论(0) 推荐(0) 编辑
摘要: char x[10]="beijing"; char c[3][10]; for(int i=0;i<3;i++) { cin>>c[i]; } if(strcmp(x,c[1])==0) cout<<"equal"<<endl; char *ch;ch=(char*)malloc(n*sizeof 阅读全文
posted @ 2018-02-12 09:13 夜游星 阅读(193) 评论(0) 推荐(0) 编辑