Suppose you have two arrays of ints, arr1 and arr2, each containing ints that are sorted in ascending order. Write a static method named merge that receives these two arrays as parameters and returns a reference to a new, sorted array of ints that is the result of merging the contents of the two arrays, arr1 and arr2. Note: you do not need to (and should not)sort here. Think of having two sorted piles of cards, that you’re combining (merging) into another pile. You keep putting cards into the new pile, sometimes taking from one of your original piles, sometimes taking from the other.

Suppose you have two arrays of ints, arr1 and arr2, each containing ints that are sorted in ascending order.  Write a static method named merge that receives these two arrays as parameters and returns a reference to a new, sorted array of ints that is the result of merging the contents of the two arrays, arr1 and arr2.  Note: you do not need to (and should not)sort here. Think of having two sorted piles of cards, that you’re combining (merging) into another pile. You keep putting cards into the new pile, sometimes taking from one of your original piles, sometimes taking from the other.

LANGUAGE: JAVA

CHALLENGE:

Suppose you have two arrays of ints, arr1 and arr2, each containing ints that are sorted in ascending order.

Write a static method named merge that receives these two arrays as parameters and returns a reference to a new, sorted array of ints that is the result of merging the contents of the two arrays, arr1 and arr2.

Note: you do not need to (and should not)sort here. Think of having two sorted piles of cards, that you’re combining (merging) into another pile. You keep putting cards into the new pile, sometimes taking from one of your original piles, sometimes taking from the other.

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days – Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level