Sparse Sets

Basic idea

A set of integers from [0,U)[0, U) stored as two arrays: dense (the elements) and sparse (positions of each element in dense). O(1)O(1) insert / delete / membership / clear, with cache-friendly iteration over members.

Key formulas

Resources

Siblings