Quick sorting archive

xiaoxiao2021-03-06  71

#include using namespace std; void swap (int & INT & B) {INT C; c = a; a = b; b = C;} void sort (int * a, int start "{ix (begin> = END) RETURN; INT I, J, K; K = a [begin]; i = begin; j = end; while (i = k ) {--J;} while (i

Void Bubblesort (int A [], int N) {INT I, J; for (i = N-1; I> -1; - i) {for (j = 0; j a [j 1]) SWAP (a [j], a [j 1]);}}}

/ * Void QSort (int * a, int start) {if (begin> = End) Return; INT I, J, K; I = Begin; J = End; K = a [begin]; while (Begin) = k) {--END;} a [begin] = a [end]; while (begin

* / int main () {INT NUM [100]; INT I, N; CIN >> N; for (i = 0; i > NUM [I];} SORT (NUM , 0, n-1); for (i = 0; i

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

New Post(0)