Question: Add a merge() method to the OrdArray class discussed in Section 2.3 (See below) of the lecture notes. The merge() method should accept two ordered

Add a merge() method to the OrdArray class discussed in Section 2.3 (See below) of the lecture notes. The merge() method should accept two ordered source arrays as parameters and merge them into an ordered destination array. Add appropriate code in main() of the OrderedApp class that inserts some numbers into the two source arrays, invokes merge(), and displays the contents of the two source arrays and the resulting destination array. Note: The source arrays may be of different sizes. In your algorithm you will need to compare the keys of the source arrays, picking the smallest one to copy into the destination array. Thus, you will need to handle the situation when one source array exhausts its contents before the other.

Note: You cannot use the insert method in your merge method.

Sample I/O: Add a merge() method to the OrdArray class discussed in Section 2.3

(See below) of the lecture notes. The merge() method should accept two

ordered source arrays as parameters and merge them into an ordered destination

Array A-0 11 22 33 44 55 66 77 88 99 Array B - 13 23 43 63 After merging, Array C-0 11 13 22 23 33 43 44 55 63 66 77 88 99

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!