插入排序之表插入
摘要:表插入时间复杂度O(n^2)附加空间O(1)稳定排序#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
using namespace std; #define LEN 8 // 有LEN个元素要排 struct Record { // 为了考察排序的稳定性,定义元素是结构体类型 int key; int otherinfo; int next;
}; void LinkListInsertSort(Record *arr, int length) // length是要排序的元素的个数,0号单元除外
{ for (int i .
阅读全文
posted @ 2012-05-20 00:09