数 据 结 构 实 验 报 告 1 各种排序算法的实现(经典) 一 实验目的 使学生掌握常用内部排序的基本概念和基本方法 使学生掌握常用内部排序方法的性能评价; 使学生掌握排序方法在实际问题中的应用; 二 实验环境 所需硬件环境为微机; 所需软件环境为Microsoft Visual C++ 6
0; 三 实验内容 此部分仅用写出要求的实验代码,并加上必要的注释 #include #define LIST_INIT_SIZE 100 #define LISTINCREMENT 10 #define OVERFLOW -2 #define OK 1 #define FAILURE 0 #define TRUE 1 #define FALSE 0 #define ERROR -1 typedef int ElemType; typedef int Status; 数 据 结 构 实 验 报 告 2 void PrintElem(ElemType *e){ printf("%5d",*e);} #include #include "ElemType
c" int p[6];//记录比较次数 int q[6];//记录移动次数 void InsertSort(int *L,int n)// 直接插入排序 { int i,j; for(i=2;i