haffman编码

#include <stdio.h>#include <stdlib.h>#include <string.h>#define MAX_INT 99999//哈夫曼树和哈夫曼编码的存储表示typedef struct{ int weight; int parent,lchild,rchild;} HTNode,*HuffmanTree; // 动态分配数组存储哈夫曼树typedef char **HuffmanCode; // 动态分配数组存储哈夫曼编码表int min(HuffmanTree t,int i){ int j,flag; int k=MAX_I...
2011-08-16 19:26 | 阅读 1027 次 | 评论 0 条

shellsort&amp;quiksort

#include<stdio.h>#include<stdlib.h>#include<time.h>int length;int j=1;//快速排序的趟数;void clear(){ char ch; do{ch=getchar();} while(ch!='\n');}//////////////////////////////////////////////////////////////////////////////int Partition(int *r, int low, int high){ //printf("第%d趟排序初始位置low:%...
2011-08-16 15:53 | 阅读 841 次 | 评论 0 条

使用队求解迷宫最短路径

#include <stdio.h>#include <stdlib.h>#define MAXQSIZE 64#define INCREMENT 16typedef struct node1{ int x; int y;} seat;typedef struct node2{ int pre; seat pos;} quequetype;typedef struct node3{ quequetype *base; int front; int rear; int size;} Queueptr;char maze[1000][1000]...
2011-08-16 15:50 | 阅读 1170 次 | 评论 0 条

使用栈求解迷宫

#include<stdio.h>#include<time.h>#include<stdlib.h>#define DOWN 1#define LEFT 2#define UP 3#define RIGHT 4#define INITSTACKSIZE 100#define INCREMENTSIZE 10#define MARK 5#define BLIND_ALLEY 6typedef int ** MazeType;MazeType Maze;int Maze_Line,Maze_Column;typedef struct{ int x; int...
2011-08-16 15:45 | 阅读 957 次 | 评论 0 条

借助栈实现单链表逆置

#include <stdio.h>#include <string.h>#include <stdlib.h>#include <malloc.h>typedef struct node{ char name[10]; char number[15]; char sex[5]; char age[5]; char _class[5]; char health[10]; struct node *next; }link,*linkptr;typedef struct lin{ linkptr base; linkptr top; //linkptr last;}...
2011-06-15 13:27 | 阅读 5352 次 | 评论 0 条

链表上的基本操作实现

#include<stdio.h>#include<string.h>#include<stdlib.h>typedef struct node{ int data; struct node *next; }link,*linkptr;void creatlink(linkptr &amp;la,int n){ linkptr q1,q2; int i; for(i=0;i<n;i++) { q1=(linkptr)malloc(sizeof(link)); if(!q1)printf("error"); ...
2011-06-15 13:21 | 阅读 1226 次 | 评论 3 条

患者到医院看病事件模拟

#include<stdio.h>#include<stdlib.h>#include<string.h>#include<malloc.h>typedef struct node{char number[20];struct node *next;}node,*queueptr;typedef struct{queueptr front;queueptr rear;}linkque;void initque(linkque &amp;q){ q.front=q.rear=(queueptr)malloc(sizeof(node)); q.front->next=NU...
2011-06-15 13:17 | 阅读 1339 次 | 评论 0 条

学生信息管理

#include <stdio.h>#include <stdlib.h>struct student{ char number[20]; char name[10]; float score1; float score2; float score3; float average; struct student *next;}node;typedef struct student jie;void view(jie *q,int num){ printf("%s %s %.2f %.2f %.2f %.2f %d\n",q->numbe...
2011-06-15 13:15 | 阅读 948 次 | 评论 0 条

括号匹配问题

标题: 括号匹配问题 时 限: 1000 ms 内存限制: 10000 K 总时限: 3000 ms 描述: 用顺序存储实现栈的初始化、入栈、出栈、取栈顶、判栈空操作。调用以上操作实现判断从键盘输入的括号序列是否匹配。 输入: 括号序列#(#为括号输入结束符号) 输出: 匹配或不匹配 输入样例: {[()]}# [{{}[(])}]# 输出样例: 匹配 不匹配 标题: 括号匹配问题 时 限: 1000 ms 内存限制: 10000 K 总时限: 3000 ...
2011-06-15 13:12 | 阅读 1099 次 | 评论 0 条
浏览66693次