Question: Rewrite Exercise 4, making MergeLists an array-based member function of the Sorted List ADT. Exercise 4 Write a client function that merges two instances of
Rewrite Exercise 4, making MergeLists an array-based member function of the Sorted List ADT.
Exercise 4
Write a client function that merges two instances of the Sorted List ADT using the following specification. MergeLists(SortedType list1, SortedType list2, SortedType& result)
1. Write the prototype for MergeLists. 2. Write the function definition, using an array-based implementation. 3. Write the function definition, using a linked implementation. 4. Describe the algorithm in terms of Big-O.
Function: Preconditions: Postconditions: Merge two sorted lists into a third sorted list. list1 and list2 have been initialized and are sorted by key using function ComparedTo. list1 and list2 do not have any keys in common. result is a sorted list that contains all of the items from list1 and list2.
Step by Step Solution
3.35 Rating (173 Votes )
There are 3 Steps involved in it
To rewrite Exercise 4 as an arraybased member function of the Sorted List ADT well need to incorporate the MergeLists operation as part of the ADT its... View full answer
Get step-by-step solutions from verified subject matter experts
