Merge sort is a comparison-based, divide-and-conquer sorting algorithm that divides the input array into smaller sub-arrays, sorts those sub-arrays, and then merges them back together to produce the sorted array. It works by repeatedly splitting the array in half until each sub-array has one element, and then merging the sub-arrays in a sorted manner.
Key Characteristics:
Time Complexity:
- Worst, average, and best case: O(n log n), where n is the number of elements.
Space Complexity: O(n), since it requires additional space to hold the temporary sub-arrays during the merging process.
Download
0 formats
No download links available.
Merge Sort | Algorithm and Example | Data Structure | NatokHD