Daa Presentation 1
Daa Presentation 1
1. Divide: Divide the list or array recursively into two halves until it
can no more be divided.
2. Conquer: Each subarray is sorted individually using the merge
sort algorithm.
3. Merge: The sorted subarrays are merged back together in sorted
order. The process continues until all elements from both
subarrays have
Illustration of Merge Sort:
Let’s sort the array or list [38, 27, 43, 10] using Merge Sort
Divide:
● [38, 27, 43, 10] is divided into [38, 27 ] and [43, 10] .
● [38, 27] is divided into [38] and [27] .
● [43, 10] is divided into [43] and [10] .
Conquer:
Stable: Yes
2. Space Complexity
Stable YES
[1,2,3,4,5]
[5,4,3,2,1]
Key Differences Between Best Case and Worst Case:
Split Step Array is split into halves Array is split into halves recursively.
recursively.