Intersection of Sorted Posting Lists

Problem Given multiple sorted lists of document IDs (postings), return the IDs present in all of them.

Input / Output

  • Input: k sorted integer lists of document IDs.
  • Output: the sorted list of IDs that appear in every input list.

Constraints

  • Lists can be large; aim for a single linear merge rather than repeated membership tests.
  • IDs within each list are strictly increasing.

Example

  • [1,2,4,8], [2,4,9], [2,4,5] → [2,4]
added …
LeaderboardSalaryAccount
Intersection of Sorted Posting Lists · 2dbi