Skip to content
Related Articles
Get the best out of our app
GFG App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Data Structures | Linked List | Question 4

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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


Answer: (D)

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. See following for implementation of merge sort using Linked List.


Quiz of this Question
Please comment below if you find anything wrong in the above post

My Personal Notes arrow_drop_up
Last Updated : 28 Jun, 2021
Like Article
Save Article
Similar Reads
Related Tutorials