/*
* 快速排序的队列实现:
* 快速排序的栈的实现。
*/
#include <iostream>
#include <queue>
using namespace std;
#define Size 20
#define Low 0
#define High Size-1
typedef int DataType;
typedef int Position;
void PaintArray(DataType Array[], int lengthOfArray);
void QuickSort(DataType Array[],const int low, const int high);
Position GetPosition(DataType Array[],const int low, const int high);
int main(void)
{
DataType Array[Size] = {
23, 25, 45, 78, 89,
12, 45, 65, 43, 32,
98, 54, 32, 54, 32,
21, 34, 54, 22, 34};
PaintArray(Array, Size);
QuickSort(Array, Low, High);
PaintArray(Array, Size);
return 0;
}
//输出
void PaintArray(DataType Array[], int lengthOfArray)
{
for(int i = 0; i < lengthOfArray; i++)
cout<<Array[i]<<" ";
cout<<endl;
}
void QuickSort(DataType Array[],const int low, const int high)
{
queue<DataType> qu;
Position mid;
if(low < high
快速排序的队列的实现
最新推荐文章于 2024-04-07 20:29:13 发布