/********************************************* * Demonstration program of Bubble sorting * * (about n*n comparisons used). * * ------------------------------------------ * * Reference: "A book on C By Al Kelley and * * Ira Pohl, The Benjamin/Cummings Publishing * * Company, Inc, 1984" [BIBLI 09]. * * * * C++ version by J-P Moreau. * * (www.jpmoreau.fr) * * ------------------------------------------ * * SAMPLE RUN: * * * * Initial table A: * * 7 3 66 3 -5 22 -77 2 36 -12 * * * * Sorted table A: * * -77 -12 -5 2 3 3 7 22 36 66 * * * *********************************************/ #include //return p,q in ascending order void Order(int *p,int *q) { int temp; if(*p>*q) { temp=*p; *p=*q; *q=temp; } } //Buuble sorting of integer array A[] void Bubble(int *a,int n) { int i,j; for (i=0; i