Saturday, 29 September 2012

Classical Programming - 4 : bubble sort (c++)

void BubbleSort(int* Data,int Count) {
    int iTemp;
    for(int i=1;i<Count;i++) {
          for(int j=Count-1;j>=i;j--) {
                if(Data[j]<pData[j-1]) {
                        iTemp = Data[j-1];
                        Data[j-1] = pData[j];
                        Data[j] = iTemp;
                     }
              }
        }
 }



No comments:

Post a Comment