Mathreport
Mathreport
Team Members:
Objective
The objective of this project is to analyze the
performance of Bubble Sort, Merge Sort, and Quick Sort.
We measure their execution time for different input sizes
to find the most efficient algorithm. The analysis also
involves statistical tests like ANOVA (Analysis of
Variance) and Tukey's HSD (Honestly Significant
Difference) to ensure that the performance differences
are statistically significant.
Problem Statement
Sorting is one of the most essential operations in
computer science, used in many applications like
searching, data analysis, and database management.
However, not all sorting algorithms perform equally well
with different types and sizes of data. This project aims
to compare the performance of three sorting algorithms:
Bubble Sort, Merge Sort, and Quick Sort. The goal is to
determine which algorithm performs the best under
various conditions
Working
Sorting Algorithms Used:
Bubble Sort: This algorithm works by repeatedly
comparing adjacent elements and swapping them if
they're in the wrong order. It continues this process until
the entire array is sorted. While it's easy to grasp, Bubble
Sort can be quite slow with large datasets, having a time
complexity of O(n²).
Merge Sort: This is a more efficient algorithm that uses
a divide-and-conquer approach. It divides the array into
two halves, sorts each half recursively, and then merges
them back together. Merge Sort has a time complexity of
O(n log n), making it faster for larger datasets.
Quick Sort: Another divide-and-conquer algorithm,
Quick Sort chooses a 'pivot' element and partitions the
array so that smaller elements come before the pivot and
larger elements come after it. It also has a time
complexity of O(n log n) and is generally faster than
Merge Sort in most practical scenarios.
Process Overview:
We tested the algorithms using arrays of various sizes:
100, 500, 1000, 5000, and 10,000 elements.
Each algorithm was run 10 times for each input size to
ensure we got reliable average execution times.
We recorded the execution time for each run.
Finally, the collected times were analyzed using
statistical tests:
ANOVA: This test checks if the differences in
performance between the algorithms are statistically
significant.
Tukey’s HSD Test: If ANOVA shows a significant
difference, this test helps identify which specific
algorithms differ from each other.
Screenshots
From the above table we can conclude that Quick Sort is the
most efficient algorithm.
Conclusion
The analysis demonstrates that Quick Sort and Merge
Sort perform efficiently, particularly for larger datasets,
while Bubble Sort is significantly slower due to its O(n²)
time complexity, making it unsuitable for large-scale
data. Statistical tests, including ANOVA and Tukey's HSD,
confirm that the differences in execution times among
the algorithms are statistically significant. Overall, Quick
Sort is identified as the most efficient algorithm, offering
the best balance between speed and performance
consistency across varying input sizes.