mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-16 00:46:06 +00:00
deploy
This commit is contained in:
@@ -1665,7 +1665,7 @@
|
||||
<span class="md-ellipsis">
|
||||
|
||||
|
||||
Chapter 6. Hash Table
|
||||
Chapter 6. Hashing
|
||||
|
||||
|
||||
|
||||
@@ -1687,7 +1687,7 @@
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
|
||||
|
||||
Chapter 6. Hash Table
|
||||
Chapter 6. Hashing
|
||||
|
||||
|
||||
</label>
|
||||
@@ -4397,7 +4397,7 @@
|
||||
1110 \rightarrow 1101 \rightarrow 0010
|
||||
\]</div>
|
||||
<p>In summary, both "first negate then add 1" and "first subtract 1 then negate" are computing the complement to <span class="arithmatex">\(10000\)</span>, and they are equivalent.</p>
|
||||
<p>Essentially, the "negate" operation is actually finding the complement to <span class="arithmatex">\(1111\)</span> (because <code>sign-magnitude + 1's complement = 1111</code> always holds); and adding 1 to the 1's complement yields the 2's complement, which is the complement to <span class="arithmatex">\(10000\)</span>.</p>
|
||||
<p>Essentially, the "negate" operation is actually finding the complement to <span class="arithmatex">\(1111\)</span> (because "sign-magnitude + 1's complement = 1111" always holds); and adding 1 to the 1's complement yields the 2's complement, which is the complement to <span class="arithmatex">\(10000\)</span>.</p>
|
||||
<p>The above uses <span class="arithmatex">\(n = 4\)</span> as an example, and it can be generalized to binary numbers of any number of bits.</p>
|
||||
|
||||
<!-- Source file information -->
|
||||
|
||||
Reference in New Issue
Block a user