Merge Sort | ALGORITHM | Sorting Algorithms | Divide & Conquer | DS & DAA | #exampreparation
#aktuexam #universityexam #btechcse #gatepreparation
Merge Sort is a classic Divide and Conquer sorting algorithm that recursively splits an array in half until single elements remain, then merges these sorted halves back together in order, resulting in a fully sorted list with an efficient O(n log n) time complexity
How Merge Sort Works (Divide & Conquer)
Divide: The unsorted array is repeatedly divided into two roughly equal halves until each sub-array contains only one element (which is inherently sorted).
Conquer: Each of these single-element sub-arrays is considered sorted. The algorithm then recursively sorts these smaller pieces.
Combine (Merge): Two adjacent sorted sub-arrays are merged into a single, larger sorted array by comparing their first elements and placing the smaller one into a new array, repeating until all elements are merged.