The time complexity of merge sort is O(n log n) for all cases—best, average, and worst—because it consistently divides the array in half and requires linear time to merge the sorted halves. The space complexity is O(n) due to the additional arrays used for merging. This efficiency makes merge sort suitable for large datasets and is particularly advantageous when stability is required.
Copyright © 2026 eLLeNow.com All Rights Reserved.