摘要: 归并排序算法就不多说了。时间复杂度及最坏情况下的时间复杂度为O(NlogN), 空间复杂度为O(N).存在问题:1. 附加内存2. 数据拷贝到临时数组,然后拷贝回来的操作放慢了排序的速度。因此,对于内存排序,一般用快速排序。上归并排序的代码:隐藏行号 复制代码 ? 归并排序#include<stdio.h>#include<stdlib.h>typedef int ElementType; void Merge(ElementType A[], ElementType TmpArray[], int Lpos, int Rpos, int RightEnd){ int 阅读全文
posted @ 2009-12-16 20:46 dskit 阅读(6926) 评论(1) 推荐(0) 编辑