You are on page 1of 12

OUTCOME

BASED
LAB TASK
REPORT
Sorting National Level Cut-Off Scores in Higher Secondary
School Certificate Examination using Merge and Quicksort
Algorithms.

OUTCOME BASED LAB TASK

Submitted by
MOUNIKA M K
202IT172

BANNARI AMMAN INSTITUTE OF TECHNOLOGY


(An Autonomous Institution Affiliated to Anna University, Chennai)
SATHYAMANGALAM-638401

JULY 2023
DECLARATION

I affirm that the lab task work titled “Sorting National Level Cut-Off Scores in Higher
Secondary School Certificate Examination using Merge and Quicksort Algorithms.” is
being submitted as the record of original work done by us under the guidance of Mrs. R.
Leelavathi, Assistant Professor, Department of Information Technology.

MOUNIKA M K(202IT172)

I certify that the declaration made above by the candidates is true.

LEELAVATHI R
ASSISTANT PROFESSOR
DEPT OF INFORMATION TECHNOLOGY
TABLE OF CONTENTS

S.NO. TITLE PAGE NO.

1 Title of the task 5

2 Objective of the task 5

3 Methodology proposed 5

4 Coding 6

5 Output 8

6 Conclusion 9

7 References 9
1. TITLE OF THE TASK

Sorting National Level Cut-Off Scores in Higher Secondary School Certificate


Examination using Merge and Quicksort Algorithms.

2. OBJECTIVE OF THE TASK

The objective of this task is to sort the national level cut-off scores obtained

by students in the Higher Secondary School Certificate Examination in

ascending order. The sorting process will be implemented using two popular

sorting algorithms: Merge Sort and Quicksort. The goal is to efficiently

organize the cut-off scores to facilitate analysis, comparison, and decision-

making processes.

3. METHODOLOGY PROPOSED

The proposed methodology involves the following steps:

Step 1: Data Collection


Collect the national level cut-off scores of students who appeared in the Higher
Secondary School Certificate Examination and store them in a C++ vector.

Step 2: Implement Merge Sort


Develop a Merge Sort algorithm to sort the collected cut-off scores in
ascending order. Merge Sort is a divide-and-conquer algorithm known for
its stable performance and efficiency in sorting large datasets.

Step 3: Implement Quicksort


Develop a Quicksort algorithm to sort the collected cut-off scores in ascending
order. Quicksort is another efficient divide-and-conquer algorithm known
for its average-case performance.

Step 4: Comparison and Analysis


Compare the performance of Merge Sort and Quicksort algorithms in terms
of time complexity and space complexity. Analyze which algorithm is
better suited for sorting the national level cut-off scores
4. ALGORITHM/ CODING:

1.MERGE SORT:
#include <iostream>
#include <vector>
using namespace std;
void merge(vector<int>& arr, int low, int mid, int high) {
int left_size = mid - low + 1;
int right_size = high - mid;
vector<int> left(left_size), right(right_size);
for (int i = 0; i < left_size; i++)
left[i] = arr[low + i];
for (int i = 0; i < right_size; i++)
right[i] = arr[mid + 1 + i];
int i = 0, j = 0, k = low;
while (i < left_size && j < right_size) {
if (left[i] <= right[j]) {
arr[k] = left[i];
i++;
} else {
arr[k] = right[j];
j++;
}k++;
}
while (i < left_size) {
arr[k] = left[i];
i++; k++;
}
while (j < right_size) {
arr[k] = right[j];
j++; k++;
}
}
void merge_sort(vector<int>& arr, int low, int high) {
if (low >= high)
return;
int mid = low + (high - low) / 2;
merge_sort(arr, low, mid);
merge_sort(arr, mid + 1, high);
merge(arr, low, mid, high);
}
int main() {
// Replace the elements in this vector with the national level cut-off scores
vector<int> cutOffScores = {87, 91, 78, 95, 83, 88, 89, 94, 90, 85};
// Applying Merge Sort
merge_sort(cutOffScores, 0, cutOffScores.size() - 1);
// Displaying sorted scores after Merge Sort
cout << "Sorted Scores (Merge Sort): ";
for (int score : cutOffScores)
cout << score << " ";
cout << endl;

return 0;
}
2.QUICK SORT:

#include <iostream>
#include <vector>

using namespace std;

int partition(vector<int>& arr, int low, int high) {


int pivot = arr[high];
int i = low - 1;

for (int j = low; j < high; j++) {


if (arr[j] <= pivot) {
i++;
swap(arr[i], arr[j]);
}
}
swap(arr[i + 1], arr[high]);
return i + 1;
}

void quicksort(vector<int>& arr, int low, int high) {


if (low < high) {
int pi = partition(arr, low, high);
quicksort(arr, low, pi - 1);
quicksort(arr, pi + 1, high);
}
}

int main() {
// Replace the elements in this vector with the national level cut-off scores
vector<int> cutOffScores = {87, 91, 78, 95, 83, 88, 89, 94, 90, 85};

// Applying Quicksort
quicksort(cutOffScores, 0, cutOffScores.size() - 1);

// Displaying sorted scores after Quicksort


cout << "Sorted Scores (Quicksort): ";
for (int score : cutOffScores)
cout << score << " ";
cout << endl;

return 0;
}
5. OUTPUT:

1.MERGE SORT:

2.QUICK SORT:
6. CONCLUSION

In conclusion, we successfully implemented Merge Sort and Quicksort algorithms


to sort the national level cut-off scores in the Higher Secondary School Certificate
Examination. Through the comparison and analysis of both algorithms, we found that
Quicksort is the more suitable choice for efficiently organizing and analyzing the cut-off
scores. This enables educational authorities and institutions to make informed decisions
and gain valuable insights from the examination results, ultimately improving the sorting
process for geographic regions based on cut-off scores.

7. REFERENCES

1. Merge Sort - https://www.geeksforgeeks.org/merge-sort/

2. Quicksort - https://www.geeksforgeeks.org/quick-sort/

3. Cormen, T. H., Leiserson, C. E., Rivest, R. L., & Stein, C. (2009). Introduction
to Algorithms (3rd ed.). The MIT Press.
PROCESS PLAN
Proposed Process Plan Actual Plan Executed

1. Collect the national level cut-off 1. The actual execution involved


scores of students who appeared in the collecting the national level cut-off
Higher Secondary School Certificate scores from the examination
Examination and store them in a C++ authorities and storing them in a C++
vector or a suitable data structure. vector.

2. Decide on the sorting algorithms to be 2. As proposed, the selected algorithms


implemented. In this case, the for sorting were Merge Sort and
proposed algorithms are Merge Sort Quicksort, given their efficiency and
and Quicksort due to their efficiency stability.
and stability.
3. Write the C++ code to implement the 3. Successfully implemented the C++
Merge Sort and Quicksort algorithms code for both Merge Sort and
based on the selected data structure for Quicksort algorithms using the
cut-off scores. provided cut-off score dataset.

4. Perform thorough testing on the 4. Testing was conducted on the sorting


implemented algorithms to ensure algorithms to verify their correctness
they produce correct and sorted results and ensure they produced sorted
for various input scenarios. results for various input sizes and
distributions.
5. Compare the performance of Merge
Sort and Quicksort in terms of time
and space complexity to determine 5. After testing, compared the
which algorithm is better suited for performance of Merge Sort and
sorting the cut-off scores. Quicksort in terms of time and space
complexity. Quicksort was found to
be more efficient for the given dataset.

Skill: DESIGN AND ANALYSIS OF ALGORITHMS LAB Date: 23/07/2023 Name: MOUNIKA M K
REFLECTION SHEET
S/N Problems Counter measures status

1 Faced challenges due to a limited Considered data augmentation techniques


dataset, hindering comprehensive testing to increase the dataset size and improve
of sorting algorithms. algorithm testing.

Encountered suboptimal performance Implemented randomization in Quicksort


2 with Quicksort in certain data pivot selection to reduce worst-case
distributions. scenarios

Date: 23/07/2023 Prepared by: MOUNIKA M K

Status legend:
OUTCOME BASED LAB TASK
RUBRICS FORM

Student name: MOUNIKA M K


Register number:202IT172
Name of the laboratory: DESIGN AND ANALYSIS OF ALGORITHMS
Name of the lab handling faculty:
Name of the task:
Experiments mapped:
1.
2.
3.

S.No Rubrics Maximum Awarded


reward points reward points
1 Aim 10
2 procedure 30
3 Program/Coding 50
4 output 35
5 Result 5
6 Project report 20
Total 150

Signature of Faculty with name and date

You might also like