Mergesort
Merge sort, also called mergesort, is a divide-and-conquer sorting algorithm. It divides the input into two halves, recursively sorts each half, and merges the two sorted halves into a single sorted sequence. The merge step combines two sorted lists by repeatedly selecting the smallest front element from either list. This approach yields a stable sort and can be implemented on arrays or linked lists.
Time complexity for the standard top-down version is O(n log n) in all cases, while the space
Applications include stable sorting where preserving the relative order of equal elements matters. It serves as