Question: Your solution should create a new list big enough to hold the contents of the current ( self ) list and the merging array list.
Your solution should create a new list big enough to hold the contents of the current self list and the merging array list.
Write tests for your class implementation that creates two arrays, inserts some random numbers into them, invokes merge to add the contents of one to the other, and displays the contents of the resulting array.
The source arrays may hold different numbers of data items.
Your algorithm needs to compare the keys of the source arrays, picking the smallest one to copy to the destination.
You also need to handle the situation when one source array exhausts its contents before the other.
Note that, in Python, you can access a parameters private attributes in a manner similar to using self. If the parameter arr is an OrderedRecordArray object, you can access its number of items as arr.nItems..
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
