📄 quicksortalgorithm.h
字号:
#include <iostream>
using namespace std;
void QuickSortAlg(float a[], int front, int end)
{
int newfront = front;
int newend = end;
int i = newfront;
while(end!=front)
{
if(front == i)
{
if(a[i]>a[end])
{
swap(a[i], a[end]);
front++;
i = end;
}
else
{
end--;
}
}
else
{
if(a[i]<a[front])
{
swap(a[i], a[front]);
end--;
i = front;
}
else
{
front++;
}
}
}
if(newfront != front)
{
QuickSortAlg(a, newfront, front-1);
}
if( newend != front)
{
QuickSortAlg(a, front+1, newend);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -