ADSA 2nd Assess
ADSA 2nd Assess
ADSA 2nd Assess
Experiment 1.2
Student Name: Vivek Kumar UID: 23BCS1318
Branch: BE-CSE Section/Group: 605-A
rd
Semester: 3 Sem Date of Performance: 09-09-2024
Subject Name: Adv. Data Structure & Algorithm Subject Code: 23CSH-204
1. Aim: You are creating an innovative method to effectively sort a huge dataset.
The program separates the dataset into smaller chunks, handles each chunk
separately and then aggregates the output. But this algorithm performance is
essential to its success.
3. Requirements(Hardware/Software):
C++ compiler.
4. Procedure:
#include<iostream>
int i, j, k;
int n1 = m - l + 1;
int n2 = r - m;
i = 0;
j = 0;
k = l;
arr[k] = L[i];
i++;
else{
arr[k] = R[j];
j++;
k++;
arr[k] = L[i];
i++;
k++;
arr[k] = R[j];
j++;
k++;
}
}
if (l < r) {
int m = l + (r - l) / 2;
mergeSort(arr, l, m);
mergeSort(arr, m + 1, r);
merge(arr, l, m, r);
int i;
int main(){
int n;
cin >> n;
int arr[n];
mergeSort(arr, 0, n - 1);
printArray(arr, n);
return 0;
5. Output:
6. Learning Outcome:
Learnt how to use of functions.
Learnt how to call a function in the main function.
Learnt the Merge sort algorithm.