Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

UGC-NET | UGC NET CS 2014 Dec – II | Question 22

  • Difficulty Level : Medium
  • Last Updated : 25 Jun, 2018

You have to sort a list L, consisting of a sorted list followed by a few ‘random’ elements. Which of the following sorting method would be most suitable for such a task?
(A) Bubble sort
(B) Selection sort
(C) Quick sort
(D) Insertion sort

Answer: (D)

Explanation: For a sorted list with few random numbers:

  • Bubble sort will take O(n2) time in best case.
  • Selection sort will take O(n2) time in best case.
  • Quick sort will take O(n2) time in this case because it is the worst case for quick sort.
  • Insertion sort will take O(n)

    So, option (D) is correct.

    Quiz of this Question

    My Personal Notes arrow_drop_up
  • Recommended Articles
    Page :

    Start Your Coding Journey Now!