Consider the null-terminated linked list of four integers $\textsf{1->2->3->4->NULL},$ and the variable 'list' points to the head of the linked list. Upon running the provided code, the linked list gets divided into two lists, as illustrated in the diagram below.
![](https://gateoverflow.in/?qa=blob&qa_blobid=15998272024441248074)
The C code that was executed is as follows:
struct ListNode {
int val;
struct ListNode *next;
}list, list2;
list2 = list->next->next->next;
list2->next = list;
//LINE X
// LINE Y
list->next->next = NULL;
list2->next->next = NULL;
To successfully accomplish the task, what should be inserted at $\textsf{LINE X}$ and $\textsf{LINE Y}?$
-
LINE X: list->next->next->next = list->next;
LINE Y: list = list->next->next;
-
LINE X: list->next->next = list->next;
LINE Y: list = list->next->next;
-
LINE X: list = list->next->next;
LINE Y: list->next->next->next = list->next;
-
LINE X:list->next->next>next = list->next>next;
LINE Y: list = list->next->next;