
数据结构
文章平均质量分 73
sukpigrabbit
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
赫夫曼树
#include #include #includeusing namespace std;const int MaxValue = 10000;//初始设定的权值最大值const int MaxBit = 4;//初始设定的最大编码位数const int MaxN = 10;//初始设定的最大结点个数struct HaffNode//哈夫曼树的结点结构{转载 2016-03-27 11:09:13 · 352 阅读 · 0 评论 -
hdu5722 Jewelry
转自http://www.cnblogs.com/fzmh/p/5688069.html题意就是说问有多少个区间,其中有至少一种种类的宝珠出现的次数恰好为x次。 先预处理出每一个位置的宝珠下一个出现与其同种类的宝珠位置next和上一个出现与其同种类的位置pre考虑在第i个位置的宝珠,要使其出现恰好x次,我们可以找到在i之后恰好出现了x次的位置j,这步操作可以用一定的技巧优化到O(1),那转载 2016-08-08 01:20:47 · 319 阅读 · 6 评论 -
单链表的建立、排序、打印
#include#include#include using namespace std;struct node{ int num; char name[10]; struct node *next;};struct node *createlink(int n){ int i; struct node *head,原创 2016-09-02 16:39:34 · 259 阅读 · 0 评论 -
循环链表的建立
#include#include#include using namespace std;struct node{ int num; char name[10]; struct node *next;};struct node *createlink(int n){ int i; struct node *head,原创 2016-09-02 16:41:04 · 346 阅读 · 0 评论 -
双向循环链表的建立
#include#include#includeusing namespace std;struct node{ int num; struct node *next,*prior;};struct node *createlink(int n){ int i; struct node *head,*p,*q; head=(struct原创 2016-09-02 17:14:24 · 408 阅读 · 0 评论 -
http://www.cnblogs.com/jiangjing/archive/2013/01/14/2860163.html
//根据前序和中序遍历写出后序遍历#includeusing namespace std;int t1[1001],t2[1001];void sousuo(int a,int b,int n,int flag){ if(n==1)//如果存在左子树或右子树就直接输出 { printf("%d ",t1[a]); return ;转载 2016-09-03 22:56:29 · 911 阅读 · 0 评论