mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-05-02 23:05:20 -04:00
Add some cool queue, stacks, strings, math, bit manipulation examples (#35)
This commit is contained in:
parent
f3ee2cdf52
commit
0f455a0322
24 changed files with 932 additions and 13 deletions
|
@ -0,0 +1,25 @@
|
|||
## bit manipulation
|
||||
|
||||
<br>
|
||||
|
||||
### `playing_with_bits.py`
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
```python
|
||||
> python3 playing_with_bits.py
|
||||
|
||||
Integer number: 144
|
||||
Binary number: 10010000
|
||||
|
||||
Update bit: 0b10010100
|
||||
Set bit: 0b10010100
|
||||
Clear bit: 0b10000000
|
||||
|
||||
I: 144, I2: 90
|
||||
B: 10010000, B2: 01011010
|
||||
Count bits swapped: 4
|
||||
|
||||
Swap bit in place: (90, 144)
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue