MCQ Practice Single Best Answer Topic: Time Complexity

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

Question ID
#15258
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(nk)
Correct Answer: D

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

Share this MCQ with your friends or study group.