Question: in C plz Use the attached code below. In this lab exam, you are going to implement mergeLists function. This function aims to merge 2

in C plz  in C plz Use the attached code below. In this lab
exam, you are going to implement mergeLists function. This function aims to
merge 2 sorted lists. Assume that input lists to mergelists is sorted.

Use the attached code below. In this lab exam, you are going to implement mergeLists function. This function aims to merge 2 sorted lists. Assume that input lists to mergelists is sorted. You are going to use input.txt as input to the program. Example: When list1->1 34679 and list2->24. the output merged list will be list3->1 23445679 . In this program, allocation is done in a smart fashion, and count of memory allocated is kept track. And in the implementation of the function mergetists, you must use already allocated memory and you are not going to allocate any extra memory. Hence: list1->1 34679 and list 2>245 at the end of first iteration, it will be list1->3 4679 , list2->245, list3->1 You will change the pointers, and do not need to allocate extra memory. Since you are always inserting to the end of list3, you can keep track of a temporary pointer as tail to ease insert at the end of the list, and not to traverse list 3 till the end at each insert. At the end of the program, ensure that Allocated memory is 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!