Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
qsort
#include <iostream> using namespace std; int podzial(int A[],int p,int r) { int x=A[r]; int i=p-1; for(int j=p;j<=r-1;j++) { if(A[j]>x) { i=i+1; swap(A[i], A[j]); } } swap(A[i+1], A[r]); return (i+1); } void quicksort(int A[], int p, int r) { if(p<r) { int q=podzial(A,p,r); quicksort(A,p,q-1); quicksort(A,q+1,r); } } int main() { int D=0; scanf("%d",&D); for(int i=0;i<D;i++) { int N=0; scanf("%d",&N); int szafa[111]; for(int j=0;j<N;j++) { scanf("%d", &szafa[j]); } quicksort(szafa,0,N-1); for(int g=0;g<N;g++) { printf("%d ", szafa[g]); } printf("\n"); } }
run
|
edit
|
history
|
help
0
multi bitmap
volatile thread-safe object
mergeSort
ExceptionHandling1
a simple tuple implementation
Pairs with given sum
Exploring the Transform Function and Operator Classes
C++ virtual dispose
SEGMENTED SIEVE
QuadRootPoint