+1 vote
in Data Structures & Algorithms I by (110k points)
Which of the following sorting algorithms can be used to sort a random linked list with minimum time complexity?

(a) Insertion Sort

(b) Quick Sort

(c) Heap Sort

(d) Merge Sort

I want to ask this question from Singly Linked List Operations in division Abstract Data Types of Data Structures & Algorithms I

This question was posed to me in my homework.

1 Answer

+1 vote
by (412k points)
selected by
Best answer
The correct option is (d) Merge Sort

Best explanation: Both Merge sort and Insertion sort can be used for linked lists. The slow random-access performance of a linked list makes other algorithms (such as quicksort) perform poorly, and others (such as heapsort) completely impossible. Since worst case time complexity of Merge Sort is O(nLogn) and Insertion sort is O(n^2), merge sort is preferred.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.