Two common building blocks for specialized data structures are rank and select.
For example, if our collection is a list of booleans (or bits), select(n) would return the index of the nth item which is set to true; rank(n) would return the number of true elements up to the nth index -- rank is sometimes also called population count or popcnt. Corresponding operations for false elements are sometimes called select0 and rank0.
These operations may not seem like much, but when they are implemented efficiently, they form the foundation for a number of more powerful data structures, such as wavelet trees. Broadly, data structures built on rank and select are often referred to as "succinct data structures," as they often use very little additional memory beyond what would be required to store the elements sequentially.
Is the Swift Algorithms package the right place to add these fundamental oeprations? I would be interested in contributing to the implementation, or having a conversation about this topic