Wrapping Up
Speaking of wow, we’ve covered so much in this chapter! We looked at sets, Boolean arrays, and bit vectors. We also looked at binary numbers, bitwise operators, and various bit manipulation techniques. We discovered how Boolean arrays can produce unique speed boosts, and how bit vectors can offer astounding space savings.
Although we implemented bit vectors from scratch, it’s worth noting that there’s also a popular Python bit vector library out there called bitarray.[7] You should definitely check that out if you’re planning on using bit vectors in production.
There does appear to be a significant limitation to Boolean arrays and bit vectors. That is, they can only be used in scenarios where the possible set values are integers ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access