Question: ( write a python code to solve the problem ) Given two sorted arrays x and Y of size m and n each, consisting of

(write a python code to solve the problem)
Given two sorted arrays x and Y of size m and n each, consisting of positive integers only. Merge the elements of x with the elements of Y maintaining the sorted order, i.e., fill x with the first m smallest elements, and fill Y with the remaining n elements.
Example Input:
x[]={1,6,10,20,30}
Y[]={2,5,25}
Example Output:
x[]={1,2,5,6,10}
Y[]={20,25,30}
Write a function to solve this problem. Your function should take the arrays and Y[] as input parameters and return x[] and Y. Do not use any extra array to solve the problem. Describe the time and space complexity of your algorithm.
 (write a python code to solve the problem) Given two sorted

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!