Merge Sort Algorithm-GROUP5
Merge Sort Algorithm-GROUP5
Introductio 2
n
•Space Complexity: O(n)
Introductio 2
n
Working of Divide and Conquer
Algorithm
Steps of Merge 3
Illustration of Merge Sort
Splitting arrays
step- by-step.
Merging back
sorted arrays.
Illustration 4
Practice Exercise
Practice 5
Answer key:
• Step 1: Divide into halves
• Left: [38, 27, 43, 3]
• Right: [9, 82, 10]
• Step 2: Recursively divide halves
• Left → [38, 27], [43, 3]
• Right → [9, 82], [10]
• Step 3: Final Merge
• Left: [3, 27, 38, 43]
• Right: [9, 10, 82]
• Combined: [3, 9, 10, 27, 38, 43, 82]
Soluti 6
Recurrence Relation of Merge
Sort:
Recurre 7
Complexity Analysis of Merge Sort
Time Complexity:
Best Case: O(n log n), array is already
sorted or nearly sorted.
Average Case: O(n log n), array is
randomly ordered.
Worst Case: O(n log n), array is sorted
in reverse order.
Comple 8
Complexity Analysis of Merge Sort
Space Complexity:
Auxiliary
Space:
Requires O(n)
auxiliary space
for temporary
arrays during
merging.
Complexity 9
Pseudocode for Merge Sort
Pseudoc 1
Pseudocode for Merge Sort
Pseudoc 1
Merge Sort for Linked Lists
Special Use Cases:
Applicati 1
Advantages of Merge Sort
Advanta 1
Disadvantages of Merge Sort
Disadvant 1
Merge Sort Vs. other Algorithms
Compari 1
Summary
Summ 1
References:
referen 2
• Burd, B. (2017). Java for dummies (5th ed.). For Dummies.
referen 2
QUESTIONS?
19