• Courses
  • Tutorials
  • DSA
  • Data Science
  • Web Tech
August 09, 2024 |170 Views

SDE Sheet - Merge K sorted Linked lists

Description
Discussion

This video is part of the Heap section under GFG SDE Sheet.

Given an array of sorted linked lists of different sizes. The task is to merge them in such a way that after merging they will be a single sorted linked list.

Examples:

Input: arr = [1->2->3, 4->5, 5->6, 7->8] Output: 1->2->3->4->5->5->6->7->8 Explanation:
The test case has 4 sorted linked list of size 3, 2, 2, 2 1st    list     1 -> 2-> 3 2nd   list      4->5 3rd    list      5->6 4th    list      7->8 The merged list will be
1->2->3->4->5->5->6->7->6

Try it out before watching the implementation of the problem in the video. We recommend watching the video, even if you can solve the problem. You may discover something new. All the best!!!

Do check out:-
Problem: https://www.geeksforgeeks.org/problems/merge-k-sorted-linked-lists/1
SDE Sheet Link: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/
Article Link: https://www.geeksforgeeks.org/merge-k-sorted-Linked-lists/