Description: ----
Huffman 算法的不同实现
本目录下的程序用8种不同的方式实现了Huffman编码算法,这8种方式分别是
* huffman_a 使用链表结构生成Huffman树的算法,这是最基本的实现方法,效率最低。
* huffman_b 使用《数据结构》(严蔚敏,吴伟民,1997,C语言版)中给出的算法,将二叉树存放在连续空间里(静态链表),空间的每个结点内仍有左子树、右子树、双亲等指针。
* huffman_c 使用Canonical Huffman编码,同时对huffman_b的存储结构进行改造,将二叉树存放在连续空间tree里,空间的每个结点类型都和结点权值的数据类型相同,空间大小为2*num,tree[0]未用,tree[1..num]是每个元素的权值,生成Huffman后,tree[1..2*num-1]中是双亲结点索引。
* huffman_d 在huffman_c的基础上,增加预先排序的功能先用QuickSort算法对所有元素的权值从小到大排序,这样,排序后最前面的两个元素就是最小的一对元素了。我们可以直接将它们挑出来,组合成一个子树。然后再子树的权值用折半插入法插到已排序的元素表中, 保证所有结点有序。为了保证初始元素的顺序不变,我们另外使用了一个索引数组,所有排序中的交换操作都是在索引数组中进行的----- Huffman algorithm to achieve Catalog under different procedures used eight different ways to achieve a Huffman coding algorithm, eight models were used huffman_a * Chain Structure Generation Huffman tree algorithm, This is the most basic method, the minimum efficiency. * Huffman_b use of "data structure" (Yan Wei Min, Xiulan WU Weimin, 1997, C language version) is the algorithm stored in a binary tree will be continuous space (static List), the space within each node still left subtree, right subtrees, parents and other indicators. * Canonical huffman_c use Huffman coding, while huffman_b storage structure transformation, will be stored in a binary tree continuous space tree, space each node type and the right node value of the same data type, size space for two * num, tree Platform: |
Size: 32702 |
Author:ray |
Hits:
Description: 1)实现以下常用的内部排序算法并对它们的时间效率进行比较:
必做(6种):起泡排序、直接插入排序、简单选择排序、快速排序、希尔排序、堆排序;
选做:折半插入、二路归并、基数排序等等;
2)函数首部要求:void XXXXSort(char **list, int len, int n, int *c, int *s)
其中:
a) XXXXSort为排序函数名,具体如下:
起泡排序BubbleSort
直接插入排序InsertSort
简单选择排序SelectSort
快速排序QuickSort
希尔排序ShellSort
堆排序HeapSort
折半插入BInsertSort
二路归并Merge2Sort
基数排序RadixSort
b) list为二维字符数组的头指针,该二维数组的规格为:char list[n][len] 每行用于存放一个字符串(最大长度为len-1),共n行;
c) c用于返回关键字比较次数;
d) s用于返回移动次数;
3)要求把各种排序函数做成函数库(文件名统一为:sort.c),用统一提供的主程序进行调用和测评。
-a) achieve the following commonly used internal sorting algorithm as well as their time efficiency comparison : regimen (6) : bubble sort, direct insertion sequence and simple choice sorting, quick sort, Hill, ranked Heap Sort; elected to do : half of insertion, two-way merge. Sort base, and so on; 2) function first requirement : void XXXXSort (char ** list, int len, int n, int * c, int * s) which : a) XXXXSort sort of a function name, as follows : bubble sort BubbleSort direct insertion sort InsertSort simple choice ranking Sele ctSort Quick Sort QuickSort Hill Sorting ShellSort Heap Sort HeapS ort half insert BInsertSort two-way merge Merge2Sort radix sort Radi xSort b) list for the two-dimensional array of characters in the first indicator, the two-dimensional array specifications : cha Platform: |
Size: 10289 |
Author:战天 |
Hits:
Description: ----
Huffman 算法的不同实现
本目录下的程序用8种不同的方式实现了Huffman编码算法,这8种方式分别是
* huffman_a 使用链表结构生成Huffman树的算法,这是最基本的实现方法,效率最低。
* huffman_b 使用《数据结构》(严蔚敏,吴伟民,1997,C语言版)中给出的算法,将二叉树存放在连续空间里(静态链表),空间的每个结点内仍有左子树、右子树、双亲等指针。
* huffman_c 使用Canonical Huffman编码,同时对huffman_b的存储结构进行改造,将二叉树存放在连续空间tree里,空间的每个结点类型都和结点权值的数据类型相同,空间大小为2*num,tree[0]未用,tree[1..num]是每个元素的权值,生成Huffman后,tree[1..2*num-1]中是双亲结点索引。
* huffman_d 在huffman_c的基础上,增加预先排序的功能先用QuickSort算法对所有元素的权值从小到大排序,这样,排序后最前面的两个元素就是最小的一对元素了。我们可以直接将它们挑出来,组合成一个子树。然后再子树的权值用折半插入法插到已排序的元素表中, 保证所有结点有序。为了保证初始元素的顺序不变,我们另外使用了一个索引数组,所有排序中的交换操作都是在索引数组中进行的----- Huffman algorithm to achieve Catalog under different procedures used eight different ways to achieve a Huffman coding algorithm, eight models were used huffman_a* Chain Structure Generation Huffman tree algorithm, This is the most basic method, the minimum efficiency.* Huffman_b use of "data structure" (Yan Wei Min, Xiulan WU Weimin, 1997, C language version) is the algorithm stored in a binary tree will be continuous space (static List), the space within each node still left subtree, right subtrees, parents and other indicators.* Canonical huffman_c use Huffman coding, while huffman_b storage structure transformation, will be stored in a binary tree continuous space tree, space each node type and the right node value of the same data type, size space for two* num, tree Platform: |
Size: 32768 |
Author:ray |
Hits:
Description: 1)实现以下常用的内部排序算法并对它们的时间效率进行比较:
必做(6种):起泡排序、直接插入排序、简单选择排序、快速排序、希尔排序、堆排序;
选做:折半插入、二路归并、基数排序等等;
2)函数首部要求:void XXXXSort(char **list, int len, int n, int *c, int *s)
其中:
a) XXXXSort为排序函数名,具体如下:
起泡排序BubbleSort
直接插入排序InsertSort
简单选择排序SelectSort
快速排序QuickSort
希尔排序ShellSort
堆排序HeapSort
折半插入BInsertSort
二路归并Merge2Sort
基数排序RadixSort
b) list为二维字符数组的头指针,该二维数组的规格为:char list[n][len] 每行用于存放一个字符串(最大长度为len-1),共n行;
c) c用于返回关键字比较次数;
d) s用于返回移动次数;
3)要求把各种排序函数做成函数库(文件名统一为:sort.c),用统一提供的主程序进行调用和测评。
-a) achieve the following commonly used internal sorting algorithm as well as their time efficiency comparison : regimen (6) : bubble sort, direct insertion sequence and simple choice sorting, quick sort, Hill, ranked Heap Sort; elected to do : half of insertion, two-way merge. Sort base, and so on; 2) function first requirement : void XXXXSort (char** list, int len, int n, int* c, int* s) which : a) XXXXSort sort of a function name, as follows : bubble sort BubbleSort direct insertion sort InsertSort simple choice ranking Sele ctSort Quick Sort QuickSort Hill Sorting ShellSort Heap Sort HeapS ort half insert BInsertSort two-way merge Merge2Sort radix sort Radi xSort b) list for the two-dimensional array of characters in the first indicator, the two-dimensional array specifications : cha Platform: |
Size: 10240 |
Author:战天 |
Hits:
Description: C++中各种几种排序算法,包括快速排序,归并排序以及一些链表的基本操作!-Several C++ in a variety of sorting algorithms, including quick sort, merge sort and list some of the basic operations of! Platform: |
Size: 2048 |
Author:蓝星 |
Hits: