14. Linked List Questions
14. Linked List Questions
Questions
them.Question 1 :
Intersection of Two Linked Lists
In a system there are two singly linked list. By some programming error, the end node of
one of the linked lists got linked to the second list, forming an inverted Y-shaped list. Write
a program to get the point where two linked lists merge.
Question 2 :
Delete N Nodes After M Nodes of a Linked List
We have a linked list and two integers M and N. Traverse the linked list such that you
retain M nodes then delete next N nodes, continue the same till end of the linked list.
Difficulty Level: Rookie.
Question 3 :
Swapping Nodes in a Linked List
We have a linked list and two keys in it, swap nodes for two given keys. Nodes should be
swapped by changing links. Swapping data of nodes may be expensive in many situations
when data contains many fields. It may be assumed that all keys in the linked list are distinct.
Question 4 :
Odd Even Linked List
We have a Linked List of integers, write a function to modify the linked list such that all
even numbers appear before all the odd numbers in the modified linked list. Also, keep the
order of even and odd numbers same.
Question 5 :
Merge k Sorted Lists
We have K sorted linked lists of size N each, merge them and print the sorted output.
Sample Input 1 : k = 2, n =
2l1 = 1->3->NULL
l2 = 6->8-
>NULL l3 = 9-
>10->NULL
#TGSFa