October 2025
Intermediate to advanced
485 pages
13h 2m
English
The key to making our bit vector work is to gain the ability to access and modify individual bits of an integer. As a reminder, our goal with a bit vector is to do things like represent the set 0, 3, 4, 6 using a single integer such as 89. Again, the way this works is that 89 in binary is 01011001 and, therefore, has 1 bits at indexes 0, 3, 4, and 6 (with index 0 being the right-most bit and the indexes increasing going leftward). Although you and I can look at the binary number 01011001 and see which indexes contain 1 bits, we need a way to write code so that the computer can do this as well.
Here’s another way to think about this problem. I once read a true story about a child genius who, despite ...
Read now
Unlock full access