organization in the src structure, modification of README

This commit is contained in:
Mari Wahl 2015-01-06 18:30:04 -05:00
parent c2ca11f247
commit 6afe96fa4d
165 changed files with 64 additions and 184 deletions

View file

@ -0,0 +1,33 @@
BIT-WISE
----------------------
1. To find a number:
11000101 is 2^0+2^2+2^6+2^7 = 197
2. Left shifting:
0010 1011 << 4 ---> 1011 000
3. Right shifting:
0010 1011 >> 4 ---> 0000 0010
or it can be filled with the copy of the first bit, instead of 0:
1011 0010 >> 4 ---> 1111 1011
4. XOR can cancels out:
15 ^ 12 ^ 15 = 12
5. 2^x:
left-shift 1 by x:
0000 0001 << x
so if x = 2, 2^2 = 4 -> 100
0000 0001 << 2 ---> 0000 0100
6. Is power of 2?
just do x&(x-1).
if 0 --> yes!