Merge Quick
Merge Quick
Objective
This assignment aims to deepen your understanding of the two important sorting
algorithms in computer science: Merge Sort and Quick Sort. You will explore the mechanisms,
analyze their complexities, and implement both algorithms.
b. Explain the working of the Quick Sort algorithm. Include the following details:
- The divide and conquer approach
- How the partitioning process works
- Time complexity analysis
2. Comparison
Compare Merge Sort and Quick Sort based on:
- Time complexity in the best, average, and worst cases
- Space complexity
- Practical applications and when one is preferred over the other
Part 2: Implementation
Write code to implement Merge Sort and Quick Sort. Follow these instructions:
3. Testing
- Test both algorithms on a variety of input arrays, including:
- Sorted arrays
- Reverse-sorted arrays
- Arrays with duplicate elements
- Arrays of random numbers
Record the time taken by each algorithm for each test case. You may use a built-in
timing function for this.