Discussion
What is the space complexity of merge sort algorithm ?
Answer: C
The space complexity of merge sort is O(n).
The standard array merge sort copies the two halves into temporary arrays to merge them, which needs auxiliary space proportional to n. The recursion stack adds only O(log n), so the total is dominated by the O(n) buffer.
O(1) extra space is achieved by in-place sorts such as heapsort. O(log n) is roughly what quick sort needs for its recursion. O(n log n) is merge sort's running time, not its space.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development