看板Oversea_Job
标 题[北美] Microsoft questions
发信站批踢踢参 (Sat Dec 15 03:38:50 2007)
转信站ptt!Group.NCTU!grouppost!Group.NCTU!ptt3
Given 2 sorted arrays, a[] and b[]
combine them with no extra array(or linear space).
e.g.: a[10] = [1, 3, 5, 7, 9]
b[3] = [2, 4, 6]
the result is a[] = [1, 2, 3, 4, 5, 6, 7, 9], assuming a[] has enough space.
Can anyone solve it? I don't see a good solution(meaning O(N)) yet.
--
※ 发信站: 批踢踢参(ptt3.cc)
◆ From: 70.20.254.187
1F:推 duer:O(5+3) is still O(N) <-- I think that's the solution 12/15 05:53