Thursday, 6 March 2014

Program of Bubble Sort

void bubbleSort(int arr[]){
int i;
int j;
int temp;
for(i = arr.length-1; i > 0; i--){
for(j = 0; j < i; j++){
if(arr[j] > arr[j+1]){
temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;
}//
}// end inner loop

}//end outer loop}// end bubble sort

No comments:

Post a Comment