Answered step by step
Verified Expert Solution
Link Copied!

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!

image text in transcribed

(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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Inductive Databases And Constraint Based Data Mining

Authors: Saso Dzeroski ,Bart Goethals ,Pance Panov

2010th Edition

1489982175, 978-1489982179

More Books

Students also viewed these Databases questions

Question

Likes confrontation or avoids it?

Answered: 1 week ago