0

merge two sorted arrays in-place in ascending order. Eg:

A[]=7,15,21
B[]=5,12

Output

A[]=5,7,12
B[]=15,21

You can't take any extra memory space except few variables.

Daniel
  • 23,129
  • 12
  • 109
  • 154
user1502308
  • 87
  • 1
  • 2
  • 9
  • This isn't really merging... As such, find any relevant sorting algorithm and just add some extra functionality to it so that it looks across two arrays instead of just one. – Dale Myers Aug 12 '12 at 14:18

1 Answers1

0

You might want to check In-place merge of two arrays) and http://www.dcs.kcl.ac.uk/technical-reports/papers/TR-04-05.pdf. How to merge two sorted arrays into a sorted array? is a simpler version of it.

Community
  • 1
  • 1
theksquare
  • 121
  • 10