上一页 1 ··· 8 9 10 11 12 13 14 15 16 下一页
摘要: //谢尔排序又称缩小增量排序法(对直接插入法的改进)#include<iostream>using namespace std;void ShellSort(int k[],int n){ int i,j,flag,gap=n; int temp; while(gap>1) { gap=gap/2; do{ flag=0; for(i=0;i<=n-gap;i++) { j=i+gap; if(k[i]>k[j]) ... 阅读全文
posted @ 2012-09-09 23:51 myth_HG 阅读(231) 评论(0) 推荐(0) 编辑
摘要: #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... 阅读全文
posted @ 2012-08-29 13:09 myth_HG 阅读(1331) 评论(0) 推荐(1) 编辑
摘要: #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)/ 阅读全文
posted @ 2012-08-27 18:30 myth_HG 阅读(1515) 评论(0) 推荐(0) 编辑
摘要: #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 阅读全文
posted @ 2012-08-26 20:57 myth_HG 阅读(7107) 评论(0) 推荐(0) 编辑
摘要: #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 阅读全文
posted @ 2012-08-25 17:09 myth_HG 阅读(11946) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<stdio.h>#include<stack>using namespace std;char Compare(char x,char y){ char c[][8]={">><<<>>", ">><<<>>", ">>>><>>", ">>>><>>", &q 阅读全文
posted @ 2012-08-03 17:02 myth_HG 阅读(475) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<stack>using namespace std;void BracketMatch(char *str){ stack<char> S; char ch; int i; for(i=0;str[i]!='\0';i++) { switch(str[i]) { case'(': case'[': case'{': S.push(str[i]); break; case')': ... 阅读全文
posted @ 2012-08-02 16:34 myth_HG 阅读(336) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<stack>using namespace std;void Conversion (int N){ int x; stack<int> s; if(N==0) { printf("%d\n",0); return ; } while(N>0) { x=N%2; s.push(x); N=N/2; } while(!s.empty()) { x=s.top(); printf("%d",x); s.pop(); } printf("\n") 阅读全文
posted @ 2012-08-02 14:17 myth_HG 阅读(413) 评论(0) 推荐(0) 编辑
摘要: Problem G Time Limit : 1000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)Total Submission(s) : 14 Accepted Submission(s) : 4Font: Times New Roman | Verdana | Georgia Font Size: ← →Problem Description有二个整数,它们加起来等于某个整数,乘起来又等于另一个整数,它们到底是真还是假,也就是这种整数到底存不存在,实在有点吃不准,你能快速回答吗?看来只能通过编程。例如:... 阅读全文
posted @ 2012-08-01 18:14 myth_HG 阅读(643) 评论(0) 推荐(0) 编辑
摘要: Problem C Time Limit : 1000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)Total Submission(s) : 21 Accepted Submission(s) : 6Font: Times New Roman | Verdana | Georgia Font Size: ← →Problem Description There must be many A + B problems in our HDOJ , now a new one is coming.Give you ... 阅读全文
posted @ 2012-08-01 18:08 myth_HG 阅读(3006) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 16 下一页