Question: Write a function merge(a, b) that takes two arrays a and b of integers, each in sorted (nondecreasing) order, and returns a new array that
Write a function merge(a, b) that takes two arrays a and b of integers, each in sorted (nondecreasing) order, and returns a new array that combines the elements of a and b in sorted order. The function should not modify a or b. IN RUBY
>> a = [1, 2, 3, 6, 9]
=> [1, 2, 3, 6, 9]
>> b = [2, 3, 5, 7] => [2, 3, 5, 7]
>> merge(a, b) => [1, 2, 2, 3, 3, 5, 6, 7, 9]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
