This is [chapter number:: 3] Operators: & | ^ > < !

Article

Space requirements

4bit for every number

  1. 1
  2. 10
  3. 11
  4. 100
  5. 101
  6. 110
  7. 111
  8. 1000
  9. 1001
  10. 1010

A number in Javascript is 64bit so 4x16 = 64 So 16 digits must be storable, first one is signed bit, are exponents and decimal stored in different ways? How will space consumption change by that?

Problems

  1. Find first set bit
  2. Rightmost different bit
  3. Check whether K-th bit is set or not
  4. Count total set bits
  5. Bit Difference
  6. Number is sparse or not
  7. Longest Consecutive 1’s
  8. Binary To Gray Code equivalent
  9. Gray to Binary equivalent
  10. Power of 2
  11. Swap all odd and even bits
  12. Maximum AND value