Problem Submissions Solution

Merge Sort for Linked List

Difficulty: Medium

Acceptance: %

Points: 30.00

Given a reference to the head of a linked list, the task is to sort the linked list using the Merge Sort algorithm.

Note: When splitting the linked list, the extra node should be included in the first half if the number of nodes is odd.


Topics

Companies

Articles

Examples:

Expected Time Complexity: O(n*log(n))

Expected Space Complexity: O(n)

Constraints:
  • 1 <= number of nodes <= 10^5
  • 0 <= node->data <= 10^6
Companies:
Amazon Microsoft Adobe Paytm
Topics:
Linked List
Locked Content
Access Restricted: Please Login to access the code editor and test cases.