MCQ Practice Single Best Answer Topic: Time Complexity

Q What is the time complexity of a selection sort algorithm for sorting an array of n elements in the worst case?

Question ID
#15272
Subchapter
Time Complexity
Action
Choose one option below

Choose Your Answer

Click an option to check whether your answer is correct.

  • A O(1)
  • B O(log n)
  • C O(n)
  • D O(n^2)
Correct Answer: D

Explanation

Selection sort is an in-place comparison-based sorting algorithm that repeatedly selects the minimum or maximum element and places it in the sorted portion of the array. In the worst case, selection sort requires nested iterations, comparing each element with the remaining unsorted portion. This results in a quadratic time complexity of O(n^2).

Share This Question

Share this MCQ with your friends or study group.