随笔分类 - 树
摘要:/*Safe Or UnsafeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1816 Accepted Submission(s)...
阅读全文
摘要:/*Binary Tree TraversalsTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4644 Accepted Submi...
阅读全文
摘要:/*StripiesTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 10270 Accepted: 4976DescriptionOur chemical biologists have invented a new very useful form of life called stripies (in fact, they were first called in Russian - polosatiki, but the scientists had to invent an English ...
阅读全文
摘要:/*Fence RepairTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 19914 Accepted: 6314DescriptionFarmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤ 20,000) planks of wood, each having some integer l...
阅读全文
摘要:/*构造哈夫曼数及哈夫曼编码*/#include<iostream>using namespace std;#define Maxlen 100typedef struct { int weight; int lchild,rchild,parent;}HTNode;typedef HTNode Hfmt[Maxlen];int n;void InitHfmt(Hfmt T){ int i; printf("\n\t\t请输入共有多少个权值(小于50):"); scanf(" %d",&n); getchar(); for(i=0;i
阅读全文
摘要:Problem D Time Limit : 2000/1000ms (Java/Other) Memory Limit : 131072/65536K (Java/Other)Total Submission(s) : 11 Accepted Submission(s) : 4Problem Description Little Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with capita...
阅读全文
摘要:#include<iostream>#include<stdio.h>#include<malloc.h>using namespace std;#define MaxSize 100#define MaxWidth 40typedef char ElemType;typedef struct Node2{ char data;//数据域 struct Node2*lchild,*rchild;//左指针域,右指针域}BTNode;void CreateBTNode(BTNode *&b,char *str)//由str串创建二叉链{ BTNode
阅读全文
摘要:#include<iostream>#include<stdio.h>#include<string.h>using namespace std;#define N 50//叶子结点数#define M 2*N-1//数中结点总数typedef struct{ char data[5];//结点值 int weight;//权重 int parent;//双亲结点 int lchild;//左孩子结点 int rchild;//右孩子结点}HTNode;typedef struct{ char cd[N];//存放哈夫曼码 int start;}HCo...
阅读全文
摘要:#include<iostream>#include<stdio.h>#include<malloc.h>using namespace std;#define MaxSize 100#define MaxWidth 40typedef char ElemType;typedef struct node{ ElemType data;//数据元素 struct node *lchild;//指向左孩子 struct node *rchild;//指向右孩子}BTNode;BTNode *CreateBT1(char *pre,char *in,int n)/
阅读全文
摘要:#include<iostream>#include<stdio.h>#include<malloc.h>using namespace std;#define MaxSize 100typedef char ElemType;typedef struct node{ ElemType data;//数据类型 struct node *lchild;//指向左孩子 struct node *rchild;//指向右孩子}BTNode;void CreateBTNode(BTNode *&b,char *str)//由str串创建二叉链{ BTNode
阅读全文
摘要:#include<stdio.h>#include<iostream>#include<malloc.h>using namespace std;#define MaxSize 100typedef char ElemType;typedef struct node{ ElemType data;//数据类型 struct node *lchild;//指向左孩子 struct node *rchild;//指向右孩子}BTNode;void CreateBTNode(BTNode *&b,char *str)//由str串创建二叉链{ BTNode
阅读全文
浙公网安备 33010602011771号