摘要: ordinary heap merge#include stdio.h#include stdlib.h#include time.h/*time functions library*/#ifndef _Heap_H#define Max_Size (100000)/*the array-size of heap*/#define K (100)/*merge K times*/#define Range (1000)/*the data X's range*/struct HeapStruct;typedef struct HeapStruct *PriorityQueue;ty 阅读全文
posted @ 2011-01-11 15:26 楚夕 阅读(372) 评论(0) 推荐(0) 编辑
摘要: #include stdio.hint table[1000];/*save the inputed hash table*/int indegree[1000];/*save every table-element's degree*/int list[1000];/*save the element's correct input order*/struct queuerecord{ int front; int rear; int buf[1000];};typedef struct queuerecord queue;queue q;/*define queue q*/void m 阅读全文
posted @ 2011-01-11 15:24 楚夕 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 四叉树法完成#include stdio.h#include stdlib.h#ifndef QuadTreetypedef struct quadtreenode *Quadtree;#endif#define MAX_SIZE (20000)struct quadtreenode{ int totalnum;/*the total population number in the area*/ Quadtree leftback; Quadtree leftfront; Quadtree rightback; Quadtree rightfront; int up,down,lef 阅读全文
posted @ 2011-01-11 15:22 楚夕 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 未测试是否正确.......#include stdio.h#include stdlib.h#include string.h#ifndef Huffman /*define all the function and data structure*/typedef int ElementType;typedef struct HeapStruct *HuffHeap;typedef struct HuffNode *Position;typedef struct HuffNode *HuffTree;/*define a huffman tree*/HuffHeap Initia 阅读全文
posted @ 2011-01-11 15:20 楚夕 阅读(267) 评论(0) 推荐(0) 编辑
摘要: 此程序为次品.......#include stdio.h#include stdlib.h#define MAX_SIZE (100000)int list[500][500];int total;int n,m,Q,vir[10000],type[10000];struct stackrecord{ int row; int col; struct stackrecord *next;};typedef struct stackrecord *stack;stack s;typedef stack nodeplace;void mkempty(){ s=(stack)malloc( 阅读全文
posted @ 2011-01-11 15:18 楚夕 阅读(198) 评论(0) 推荐(0) 编辑
摘要: #include stdio.h#define MAX_SIZE (10000)struct node{ int qnum; int key;};typedef struct node listnode;listnode list[1000];int queue[1000];void checklist(int n,int m,int k,int q){ int i,j,t,min,times=0; int results[1000]; for(i=0;i1000;i++) results[i]=0; t=0; while(timesk) { min=MAX_SIZE; for 阅读全文
posted @ 2011-01-11 15:16 楚夕 阅读(134) 评论(0) 推荐(0) 编辑