In-place merge of two arrays

前端 未结 4 2067
小鲜肉
小鲜肉 2021-02-01 06:54

We have an array of size m+n in which m elements are present, in sorted order, and a second array of size n, again in sorted order. We want both of

4条回答
  •  -上瘾入骨i
    2021-02-01 06:56

    Move the contents of the first array to the end of the first array, such that the empty elements are now at the beginning. Then merge the two sequences as usual into the first array.

提交回复
热议问题