代码
WY5421
这个作者很懒,什么都没留下…
展开
-
双向队列
#include #include #include typedef struct node { int data; node *next; }*qtype; typedef struct { qtype front,rear; }que; int QueInit(que &q) //初始化一个队列 { q.fron原创 2016-08-15 20:54:31 · 313 阅读 · 0 评论 -
数据结构实验之队列一:排队买饭
#include #include #include typedef struct node { int data; node *next; }*qtype; typedef struct { qtype front,rear; int length; } que; int QueInitial(que &q) { q.front=q.rear=(q原创 2016-08-16 09:50:14 · 817 阅读 · 1 评论 -
数据结构实验之求二叉树后序遍历和层次遍历
#include #include #include typedef struct tnode { char data; tnode *lc,*rc; }*tree; void build(tree &t,char *he,char *mid,int len) //数组用字符来代替 { if(len==0) t=NULL; //递归停止条件 else原创 2016-08-22 20:42:55 · 341 阅读 · 0 评论 -
数据结构实验之求二叉树后序遍历和层次遍历(简单版)
#include #include #include typedef struct tnode { char data; tnode *lc,*rc; }*tree; void build(tree &t,char *he,char *mid,int len) //数组用字符来代替 { if(len==0) t=NULL; //递归停止条件 else原创 2016-08-22 20:53:46 · 345 阅读 · 0 评论 -
hash---出现过的数字
查找练习 hash——出现过的数字 Time Limit: 1000MS Memory limit: 65536K 题目描述 有一个数据字典,里面存有n个数字(n 输入 输入数据只有一组! 第一行包含两个整数n m,分别代表字典中数字的个数和要查询的数字的个数。 接着n行代表字典中的n个数字。 最后m表示要查询的数字。原创 2016-08-24 11:10:56 · 323 阅读 · 0 评论 -
希尔排序
数据结构实验之排序六:希尔排序 Time Limit: 1000MS Memory limit: 65536K 题目描述 我们已经学习了各种排序方法,知道在不同的情况下要选择不同的排序算法,以期达到最好的排序效率;对于待排序数据来说,若数据基本有序且记录较少时, 直接插入排序的效率是非常好的,希尔排序就是针对一组基本有序的少量数据记录进行排序的高效算法。你原创 2016-08-24 14:54:52 · 276 阅读 · 0 评论 -
还原二叉树
#include #include #include using namespace std; typedef struct tnode { char data; tnode *lc,*rc; }*tree; void build(tree &t,char he[],char mid[],int hep,int midp,int len) { if(len==0)原创 2016-08-22 16:37:13 · 383 阅读 · 0 评论 -
数据结构实验之排序五:归并求逆序数
数据结构实验之排序五:归并求逆序数 Time Limit: 20MS Memory limit: 65536K 题目描述 对于数列a1,a2,a3…中的任意两个数ai,aj (i < j),如果ai > aj,那么我们就说这两个数构成了一个逆序对;在一个数列中逆序对的总数称之为逆序数,如数列 1 6 3 7 2 4 9中,(6,4)是一个逆序对,同样还原创 2016-08-25 10:47:19 · 349 阅读 · 0 评论 -
数据结构实验之栈与队列四:括号匹配
roblem Description 给你一串字符,不超过50个字符,可能包括括号、数字、字母、标点符号、空格,你的任务是检查这一串字符中的( ) ,[ ],{ }是否匹配。 Input 输入数据有多组,处理到文件结束。 Output 如果匹配就输出“yes”,不匹配输出“no” Sample Input sin(20+10) {[}] Sample Output ye...原创 2019-09-18 20:24:14 · 293 阅读 · 0 评论