Data Structure Time Complexity Question #15272
Single Choice Easy

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

ID: #15272 Time Complexity 200 views
Question Info
#15272Q ID
EasyDifficulty
Time ComplexityTopic

Choose the Best Option

Click any option to instantly check if you're correct.

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

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

Challenge a friend or share with your study group.