Question 4

Which of the following sorting algorithms has the worst time complexity of nlog(n)?

  1. AHeapsort
  2. BQuicksort
  3. CInsertion sort
  4. DSelection sort
Show answerHide answer

Correct answer: (A) Heapsort

Explanation

Heapsort is O(n log n) even in the worst case. Quicksort's worst case is O(n²), and insertion and selection sort are O(n²).

From DSSSB TGT Computer Science Practice Set 4

This is question 4 of DSSSB TGT Computer Science Practice Set 4. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.