MDSA Lab Task 10
MDSA Lab Task 10
MDSA Lab Task 10
Course/Lab Instructor
Sir Maaz.
LAB TASK 10
Task 1:
Quick Sort :
#include <iostream>
// QuickSort function
void quickSort(int arr[], int low, int high) {
if (low < high) { // Partitioning index
int pi = partition(arr, low, high);
int main() {
int arr[] = {10, 7, 8, 9, 1, 5};
int n = sizeof(arr) / sizeof(arr[0]);
1
cout << "Unsorted array: ";
printArray(arr, n);
quickSort(arr, 0, n - 1);
Output:
2
Task 2:
Merge Sort:
#include <iostream>
// Clean up
delete[] leftArray;
delete[] rightArray;
}