Write a function in c++ to merge the contents of Two sorted arrays A and B into third array C . Assuming the array A is sorted in ascending order and B is sorted descending order , the resulting required to be in ascending order
Answers
Answered by
2
Thank you for asking this question. This question isnt that hard as much it looks to be.
Basically first you can initialize a new array and name it C. Now start a for loop that goes till size of A and B. Now start adding elements of Array A into array C and then start from the backwards of array B and merge that into Array C.
FInally you can do merge or quick sort on the final array and have an Array C that is in ascending order.
I hope this answer can help you in some manner.
Basically first you can initialize a new array and name it C. Now start a for loop that goes till size of A and B. Now start adding elements of Array A into array C and then start from the backwards of array B and merge that into Array C.
FInally you can do merge or quick sort on the final array and have an Array C that is in ascending order.
I hope this answer can help you in some manner.
Similar questions