Professional Documents
Culture Documents
CSE373 Assignment1
CSE373 Assignment1
CSE373 Assignment1
Assignment-1
Submitted to:
Dr. Sifat Momen (Sfm1)
Associate Professor
Department of Electrical and Computer Engineering
Submitted by:
Shishir Oyshi
ID: 2014334642
ECE Department
Merge Sort:
1
Heap Sort:
2
Quick Sort:
3
2. Experimental Analysis
Code
(Generating random datasets representing packages with varying sizes
4
Output
(Measuring and recording the execution time of each algorithm for different dataset
sizes)
5
Graph (Execution Time VS Dataset Size)
3. Discussion
Analyzing Results:
Compare the time complexity: Insertion Sort (O(n^2)), Merge Sort (O(n log n)), Heapsort
(O(n log n)), Quicksort (O(n log n) on average, O(n^2) in worst case).
Space complexity: Insertion Sort (O(1)), Merge Sort (O(n)), Heapsort (O(1)), Quicksort
(O(log n) on average due to recursion).
Suitability Analysis:
For small datasets or nearly sorted data, Insertion Sort might be efficient.
For larger datasets, Merge Sort and Heapsort are generally more stable in performance.
6
Quicksort is often faster in practice for average cases but has a worst-case scenario to
consider.
Recommendation:
Given the logistics company's need for efficiency with large datasets, Merge Sort or
Heapsort are likely the best choices due to their consistent O(n log n) performance and
relatively straightforward implementation.