exp 10: call bubble_sort
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
8
10.c
8
10.c
@@ -31,7 +31,7 @@ void insertion_sort(int arr[], int n) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bubble(int arr[], int n) {
|
void bubble_sort(int arr[], int n) {
|
||||||
for (int i = 0; i < n - 1; i++) {
|
for (int i = 0; i < n - 1; i++) {
|
||||||
int swapped = 0;
|
int swapped = 0;
|
||||||
|
|
||||||
@@ -171,5 +171,11 @@ int main() {
|
|||||||
heap_sort(arr5, SIZE);
|
heap_sort(arr5, SIZE);
|
||||||
display(arr5, SIZE);
|
display(arr5, SIZE);
|
||||||
|
|
||||||
|
int arr6[] = {1, 10, -100000, 1, -2};
|
||||||
|
printf("Bubble Sort on: ");
|
||||||
|
display(arr6, SIZE);
|
||||||
|
bubble_sort(arr6, SIZE);
|
||||||
|
display(arr6, SIZE);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user