Professional Documents
Culture Documents
Lab 12 M.Ali Arif
Lab 12 M.Ali Arif
LAB REPORT 12
Submitted By:
M.ALI ARIF
F20604037
Submitted To:
Dr. Umair/ Engr. Abdul Qadeer
Code:
//Muhammad Ali Arif
//F20604037
#include <iostream>
using namespace std;
void selectionSort(int arr[], int n) {
int i, j, min_idx;
selectionSort(arr, n);
cout << "Sorted array: ";
for (int i = 0; i < n; i++)
cout << arr[i] << " ";
cout << endl;
return 0;
}
OUTPUT:
Write a code to sort the following arrays using bubble sort method.
int main() {
int arr[] = {10, 34, 2, 56, 7, 67, 88, 42};
int n = sizeof(arr)/sizeof(arr[0]);
bubbleSort(arr, n);