给定两个已排序的数组:A 和 B.数组A的大小为La,数组B的大小为Lb.如何找到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?
如果La比Lb大很多,那么求交算法会有什么不同吗?
If La is much bigger than Lb, then will there be any difference for the intersection finding algorithm?
推荐答案Use set_intersection as 此处.通常的实现类似于归并排序算法的合并部分.
Use set_intersection as here. The usual implementation would work similar to the merge part of merge-sort algorithm.