DSL Experiment No 8 STD
DSL Experiment No 8 STD
Experiment No. 08
Aim: Implementation of Selection sort, Bubble sort, Insertion sort, Quick sort.
Code:
// C program for implementation of selection sort
#include <stdio.h>
Code:
// C program for implementation of Bubble sort
#include <stdio.h>
insertionSort(arr, n);
printArray(arr, n);
return 0;
}
Output:
Quick Sort:
// Quick sort in C
#include <stdio.h>
// Driver code
int main() {
int data[] = {8, 7, 2, 1, 0, 9, 6};
int n = sizeof(data) / sizeof(data[0]);
quickSort(data, 0, n - 1);
printf("Sorted array in ascending order: \n");
printArray(data, n);
}
Output:
Conclusion: -
Thus in this experiment we implemented Selection sort, Bubble sort, Insertion sort, Quick sort.