Friday, March 1, 2019

Using MergeSort to sort a LinkedList

Task: Sort a linked list using Merge Sort Algorithm.

GFG Link: https://www.geeksforgeeks.org/merge-sort-for-linked-list/

Why Merge Sort for Linked List Sorting?

The slow random-access performance of a linked list makes some other algorithms (such as quicksort) perform poorly, and others (such as heapsort) completely impossible.

Java:

Time Complexity : O(nlogn)
Space Complexity : O(n)

No comments:

Post a Comment