Single Choice
Easy
QWhat is the time complexity of a merge sort algorithm for sorting an array of n elements in the worst case?
ID: #15248
Time Complexity
140 views
Question Info
#15248Q ID
EasyDifficulty
Time ComplexityTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer
Explanation
Merge sort is a divide-and-conquer sorting algorithm that recursively divides the array into smaller subarrays, sorts them individually, and then merges them back together. In each recursive call, the array is split in half, resulting in a logarithmic number of divisions. Afterward, the merging process takes linear time to combine the sorted subarrays. Therefore, the time complexity of merge sort in the worst case is O(n log n).
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic