The intersection of two sorted arrays

algorithm, arrays, sorting

Solution

Use `set_intersection` as here. The usual implementation would work similar to the merge part of merge-sort algorithm.

Problem

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?

Original source

Related problems