We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d199d64 commit 82011c4Copy full SHA for 82011c4
src/algebra/bit-manipulation.md
@@ -207,7 +207,7 @@ We can see that the all the columns except the leftmost have $4$ (i.e. $2^2$) se
207
With the new knowledge in hand we can come up with the following algorithm:
208
209
- Find the highest power of $2$ that is lesser than or equal to the given number. Let this number be $x$.
210
-- Calculate the number of set bits from $1$ to $2^x - 1$ by using the formua $x \cdot 2^{x-1}$.
+- Calculate the number of set bits from $1$ to $2^x - 1$ by using the formula $x \cdot 2^{x-1}$.
211
- Count the no. of set bits in the most significant bit from $2^x$ to $n$ and add it.
212
- Subtract $2^x$ from $n$ and repeat the above steps using the new $n$.
213
0 commit comments