Algorithm
Merge Sort Algorithm:
- Start with an unsorted array.
- Divide the array into two halves recursively until each subarray contains only one element.
- Merge the subarrays back together in a sorted manner:
- Compare the elements of both subarrays.
- Place the smaller element into the sorted array.
- Repeat the comparison and placement until all elements are merged.
- The merging process continues until the entire array is sorted.
Example:

Fig. 1: Iteration by Iteration Visualization of Merge Sort
Note: Merge Sort efficiently divides and conquers, making it suitable for large datasets.