Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

in C urgent!!!

image text in transcribed
image text in transcribed
image text in transcribed
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 u input.txt as input to the program. Example: When list1 >1 34679 and list2->245 the output merged list will be list3->123445679. 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 mergelists, you must use already allocated memory and you are not going to allocate any extra memory. Hence: list1->134 479 and list 245 at the end of first iteration, it will be list1->34679, 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

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

Database Design Using Entity Relationship Diagrams

Authors: Sikha Saha Bagui, Richard Walsh Earp

3rd Edition

103201718X, 978-1032017181

More Books

Students also viewed these Databases questions