1 Answers
Time Complexity of Merge Sort and How It Works
Merge Sort is a sorting algorithm with a time complexity of O(n log n). It follows a divide and conquer approach to sorting elements.
The algorithm works by dividing the array into two halves, recursively sorting each half, and then merging the two sorted halves. Here is a high-level overview of how Merge Sort works:
- Divide the array into two halves
- Recursively sort each half
- Merge the sorted halves together
By using this approach, Merge Sort achieves O(n log n) time complexity, making it one of the most efficient sorting algorithms available.
Please login or Register to submit your answer