Github Repo: https://github.com/Bengalize/projects/tree/main/Essential Algorithms/Comparative Analysis of Sorting Algorithms
Date: 03/16/23
This project involved implementing and testing five sorting algorithms: Quick Sort, Bubble Sort, Selection Sort, Insertion Sort, and Merge Sort. The goal was to analyze their performance across different initial configurations: Random, Almost Sorted, and Reverse Sorted. I evaluated each algorithm on parameters like execution time, the number of comparisons, and swaps for varying data sizes.
While the algorithms performed as expected, there was an issue with output formatting. Specifically, the function names were displayed as memory addresses (e.g., {<function quickSort at 0x10eb92440>}) instead of their actual names like quickSort.
Below are sample of the average times, comparisons, and swaps recorded for each algorithm under different initial configurations.
Initial Configuration: Random
Min Size: 32
Max Size: 512
Trials: 20
| Size | Avg Time (ms) | Avg Comparisons | Avg Swaps |
|---|---|---|---|
| 32 | 7.25 | 10 | 4 |
| 64 | 7.75 | 10 | 4 |
| 96 | 7.15 | 10 | 4 |
| 128 | 7.90 | 10 | 4 |
| ... | ... | ... | ... |
| 512 | 13.20 | 10 | 4 |
Initial Configuration: Random