







Remarks: By default, we show e-Lecture Mode for first time (or non logged-in) visitor.
If you are an NUS student and a repeat visitor, please login.
Pro-tip 1: Since you are not logged-in, you may be a first time visitor (or not an NUS student) who are not aware of the following keyboard shortcuts to navigate this e-Lecture mode: [PageDown]/[PageUp] to go to the next/previous slide, respectively, (and if the drop-down box is highlighted, you can also use [→ or ↓/← or ↑] to do the same),and [Esc] to toggle between this e-Lecture mode and exploration mode.
- 设置 S 的值
- 将第 j 位设为 on
- 判断第 j 位的值
- 将第 j 位设为 off
- 对第 j 位取反
- 最低有效位
Pro-tip 2: We designed this visualization and this e-Lecture mode to look good on 1366x768 resolution or larger (typical modern laptop resolution in 2021). We recommend using Google Chrome to access VisuAlgo. Go to full screen mode (F11) to enjoy this setup. However, you can use zoom-in (Ctrl +) or zoom-out (Ctrl -) to calibrate this.
Pro-tip 3: Other than using the typical media UI at the bottom of the page, you can also control the animation playback using keyboard shortcuts (in Exploration Mode): Spacebar to play/pause/replay the animation, ←/→ to step the animation backwards/forwards, respectively, and -/+ to decrease/increase the animation speed, respectively.
如果您需要位掩码/位操作的示例源代码,请看:bit_manipulation.cpp | py | java | ml。
如需测试您对位操作的理解,可以试试 Online Quiz on bitmask topic。
如果您想要关于位掩码/位操作的更有挑战性的问题,试试这里的在线题目:UVa 11933 - Splitting Numbers 和 Kattis - bitbybit。
除了这些简单的应用,位掩码还常常在高级算法中作为低级优化出现,所以您需要做好在更大的问题中碰到位掩码组件的心理准备。
You have reached the last slide. Return to 'Exploration Mode' to start exploring!
Note that if you notice any bug in this visualization or if you want to request for a new visualization feature, do not hesitate to drop an email to the project leader: Dr Steven Halim via his email address: stevenhalim at gmail dot com.
设置 S
将第 j 位设为 on
判断第 j 位的值
将第 j 位设为 off
对第 j 位取反
最低有效位