C ++ sort algorithm

xiaoxiao2021-03-06  116

#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;}} = {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-126257.html

New Post(0)