Given two sorted arrays of size m and n respectively (m >> n), how to merge them together?
Given two sorted arrays of size m and n respectively (m » n), how to merge them together? (Note: if you try to insert n numbers to the larger array to obtain O(n \log m) complexity, pay attention that you have to move elements around for insertions. Also, simply merging those two arrays is not the optimal solution here.) Solution
Consider A[m+1] and B[n+1] and C[m+n] (m»n and indexing starts from 1)
[Read More]