@MartinJaniczek A traditional approach is the
segmented array, where divisions are kept track of with a Boolean vector (remember that those only use 1
bit per element), but of course, if your Boolean would be very sparse, then indices are more efficient.