由于两个排序数组: A
和 B
。数组的大小 A
是拉
和数组的大小 B
是磅
。如何找到的路口 A
和 B
?
Given two sorted arrays: A
and B
. The size of array A
is La
and the size of array B
is Lb
. How to find the intersection of A
and B
?
如果拉
比磅
大得多,那么会有的交集任何区别寻找算法?
If La
is much bigger than Lb
, then will there be any difference for the intersection finding algorithm?
使用 set_intersection
为此处。通常的实现将工作类似于归并排序算法合并的部分。
Use set_intersection
as here. The usual implementation would work similar to the merge part of merge-sort algorithm.
上一篇:产生一个数的分区分区、个数