Question: 1 2 . 6 . 4 : Write a function that merges two previously sorted vectors, and returns the merged version. Full screen The implementation

12.6.4: Write a function that merges two previously sorted vectors, and returns the merged version.
Full screen
The implementation of the merge function used by merge_sort merges adjacent ranges contained in a single array. Rearrange the following lines of code to implement a different approach. Instead of receiving a single array, write a function that merges two previously sorted vectors, and returns the merged version.Unused
{ result.push_back(b[i2]); i2++;
}
while (il a.size() && i2 b.size())
{
}
while (i2 b.size())
{
result.push_back(b[i2]); i2t+;
}
vectori1=0i2=0a={32,71,12,45,2}b={27,91,2,53,64}c=merge(a,b)nn
 12.6.4: Write a function that merges two previously sorted vectors, and

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!