• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
September 13, 2023 |150 Views
SDE Sheet - Merge two sorted Linked lists
  Share   Like
Description
Discussion

This video is part of the Linked List section in the GFG SDE Sheet.

In this video, we are given two sorted linked lists consisting of N and M nodes respectively. The task is to merge both of the list (in-place) and return head of the merged list.

Example :

Input:
N = 4, M = 3 
valueN[] = {5,10,15,40}
valueM[] = {2,3,20}

Output: 2 3 5 10 15 20 40

Explanation: After merging the two linked lists, we have merged list as 2, 3, 5, 10, 15, 20, 40.

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:-

Article: https://www.geeksforgeeks.org/merge-two-sorted-Linked-lists/
Problem: https://practice.geeksforgeeks.org/problems/merge-two-sorted-linked-lists/1
SDE Sheet: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/

Read More