C ++ sort algorithm

xiaoxiao2021-03-06  111

#include

Void Selectsort (int Arr [], int LEN)

{

For (int i = 0; i

{

INT min = i;

For (int J = i 1; j

{

IF (Arr [J]

{

min = j;

}

}

INT TEMP = Arr [I];

Arr [i] = arr [min];

Arr [min] = TEMP;

}

}

Void insertsort (int Arr [], int LEN) {for (int i = 1; i = 0 && TMP < Arr [J]; J - {Arr [J 1] = Arr [J]} Arr [J 1] = TMP;}}

Void Bubblesort (int Arr [], int LEN) {for (int i = len-1; i> 0; I -) {bool exchange = false; for (int J = 0; j Arr [J 1]) {INT TMP = Arr [I]; Arr [i] = arr [= "= true;}} = true;}}} est {Return;}}}}

Void Quicksort (int Arr [], int = i; int high = j; if (low low && arr [ HIGH]> = pivot) {high-;} if (high> low) {arr [limited = arr [high];} while (low

转载请注明原文地址:https://www.9cbs.com/read-104066.html

New Post(0)