Question: 5. (30 points) Write a program that implements the following method (you need to call the method in vour main method). A method that given

5. (30 points) Write a program that implements the following method (you need to call the method in vour main method). A method that given an array nums consisting of 2n elements in the form [x1,x2xn,y1,y2,,yn], it returns the array in the form [x1,y1,x2,y2xn,yn]. Example 4: Inputi naies k2,12,1,3,4,71,n=3 Example 21 Inputy nuss {{1,2,5,4,4,3,2,2},n=1} outout: {2,4,2,3,3,2,4,1] Example 3. Inputi 1 and (12,2,2,2),17=2 output (1,2,+,2) I a ampole 11 Ifputi inats (2,3,1,3,4,7)+k=1 Outputi (2,3,7,4,1,7) I a ampote 21 Inputi nues =(1,2,1,4,3,1,3,1},n=4 Dutput 11,1,7,3,3,2,4,1) Csampie 3 Ifputi muta ={2,1,2,2},n=2 0utput, 1,2,3,2)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
