Question: Write a client function that merges two instances of the Sorted List ADT using the following specification (listed below the questions). 4. Write the function

Write a client function that merges two instances of the Sorted List ADT using the following specification (listed below the questions).

4. Write the function definition, using a linked implementation.

5. Rewrite Exercise 4, making MergeLists an array-based member function of the Sorted List ADT.

6. Rewrite Exercise 5, making MergeLists a linked member function of the Sorted List ADT.

Specifications:

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

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!