Data Structure Time Complexity Question #15258
Single Choice Easy

QWhat is the time complexity of a radix sort algorithm for sorting an array of n elements with k digits in the worst case?

ID: #15258 Time Complexity 154 views
Question Info
#15258Q 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(nk)
Correct Answer

Explanation

Radix sort is a non-comparative sorting algorithm that sorts elements by their individual digits or bits. In the worst case, where the number of digits (k) is constant, radix sort performs counting sort or bucket sort on each digit. Since each counting sort or bucket sort takes linear time (O(n)), and there are k digits to sort, the overall time complexity becomes O(nk).

Share This Question

Challenge a friend or share with your study group.