//******************************************* 内部排序部分
/*
#include "CodeTest.h"
#include <iostream>
using namespace std;
typedef int ElemType;
typedef unsigned int NumType;
ElemType A[10]={4,3,2,1,5,6,8,7,9,0};// 尾部是0
ElemType AA[10]={4,3,2,1,5,6,8,7,9,0};// 尾部是0
ElemType BB[8]={49,38,65,97,76,13,27,49};//教材范例,重复49
ElemType CC[8]={0,1,2,3,4,5,6,7};//有序数
ElemType DD[8]={7,6,5,4,3,2,1,0};//逆序数
ElemType EE[8]={7,6,5,4,3,2,1,0};//逆序数
ElemType FF[8]={49,38,65,97,76,13,27,49};//
NumType DT[3]={5,3,1};//增量序列数组
ElemType GG[8]={49,38,65,97,76,13,27,49};//
void main()
{
Status BubbleSort(ElemType A[],NumType n);
Status QuickSort(ElemType A[], NumType low, NumType high);
int fac(int n);
Status InsertSort(ElemType A[], NumType n);// 函数声明
void print(ElemType A[],NumType n);
Status ShellSort(ElemType A[],NumType n, NumType dks[],NumType t);
printf("\n交换排序之冒泡排序:\n" );
print( A,10);
BubbleSort(A, 10);
print( A,10);
printf("\n交换排序之快速排序:\n" );
print( AA,10);
QuickSort(AA,0,9); //QuickSort(A,0,n-1);
print( AA,10);
print( BB,8);
QuickSort(BB,0,7); //QuickSort(A,0,n-1);
print( BB,8);
print( CC,8);
QuickSort(CC,0,7); //QuickSort(A,0,n-1);
print( CC,8);
print( DD,8);
QuickSort(DD,0,7); //QuickSort(A,0,n-1);
print( DD,8);
printf("\n插入排序之直接插入排序:\n" );
print( EE,8);
InsertSort( EE, 8);
print( EE,8);
print( FF,8);
InsertSort( FF, 8);
print( FF,8);
printf("\n插入排序之希尔排序:\n" );
print( GG,8);
ShellSort(GG, 8,DT,3);
print( GG,8);
printf("\n递归之fac数列:\n" );
printf("\nfac is %d\n", fac(5));// 支持递归调用。
}/// main
内部排序调用main
最新推荐文章于 2025-11-25 11:31:36 发布
5931

被折叠的 条评论
为什么被折叠?



