Today we are going to learn how to merge a linked list into another linked list. like we have two linked lists as you see in the images given below.
The first linked list has four nodes.
a second linked list has three nodes.
so we want to merge the second list into the first list. so first we need to find the reference of the last node of the first linked list.
and then we store the second linked list’s first node’s reference into the linked part of the last of the first linked list.
so now the second linked list is merged into the first linked list.