Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ 4. Write a client function that merges two instances of the Sorted List ADT

ID: 3844119 • Letter: C

Question

C++

4. Write a client function that merges two instances of the Sorted List ADT using the following specification; Write the function definition, using a linked implementation.

MergeLists(SortedType list1, SortedType list2, SortedType& result)

Function: Merge two sorted lists into a third sorted list.

Preconditions: list1 and list2 have been initialized and are sorted by key using function ComparedTo. list1 and list2 do not have any keys in common

Postconditions: result is a sorted list that contains all of the items from list1 and list2

Explanation / Answer

Below is your program: -

SortedList MergeLists(SortedType list1, SortedType list2, SortedType& result){

   

    Merge(list1,list2,result);

    return result;

}