源码:
#include<iostream>
#include <time.h>
#include <windows.h>
#include <stack>
#include <cstdlib>//随机数
#define MaxSize 10000
using namespace std;
typedef struct
{
int Data[MaxSize]; // 存储元素的数组
int topIdx; //栈顶指针
}SeqStack;
int Partition_1(int low, int high, int a[])
{
a[0] = a[low];
while (low<high)
{
while (low<high&&a[high]>=a[0])
{
--high;
}
a[low] = a[high];
while (low < high && a[low] <= a[0])
{
++low;
}
a[high] = a[low]