Professional Documents
Culture Documents
Code For Selection Sort
Code For Selection Sort
#include <iostream>
int count = 0;
int temp;
temp = a;
a = b;
b = temp;
int i, j, imin;
imin = j;
swap(array[i], array[imin]);
int main()
display(arr, 10);
selectionSort(arr, 10);
display(arr, 10);
return 0;
Output:-
2
Code for bubble sort:-
#include <iostream>
int count = 0;
int temp;
temp = a;
a = b;
b = temp;
}
void bubbleSort(int *array, int size)
int i, j;
swap(array[j], array[j+1]);
count++;
int main()
display(arr, 10);
bubbleSort(arr, 10);
display(arr, 10);
return 0;
Output:-