Answered step by step
Verified Expert Solution
Question
1 Approved Answer
THIS PROGRAM SHOULD BE DONE IN C Programming Language! (4) Merge You're given the pointer to the head nodes of two sorted linked lists. The
THIS PROGRAM SHOULD BE DONE IN C Programming Language!
(4) Merge You're given the pointer to the head nodes of two sorted linked lists. The data in both lists will be sorted in ascending order. Change the next pointers to obtain a single, merged linked list which also has data sorted in ascending order. Either head pointer given may be null meaning that the corresponding list is empty Input Format You have to complete the Node* MergeLists (Node* headA, Node* headB) function which takes two arguments the heads of the two sorted linked lists to merge. Read input from console to first create the sorted linked lists A and B. The first line of input is the number of test cases. For each test case, there are two lines of input strings representing list A and B Output Format Change the next pointer of individual nodes so that nodes from both lists are merged into a single list. Then return the head of this merged list. Write a print() function to print the final sorted list to the console Sample Input 1->3->5->6-NULL 15 -NULL 12-NULL NULL 1->2->NULL Sample Output 1->2->3-4-5-6- 12-> 15 .> NULL 1->2->NULL 7-NULL
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started