mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-14 03:22:23 +08:00
deploy
This commit is contained in:
@ -3314,7 +3314,7 @@
|
||||
|
||||
<h1 id="16">16. 附录<a class="headerlink" href="#16" title="Permanent link">¶</a></h1>
|
||||
<div class="center-table">
|
||||
<p><img alt="附录" src="../assets/covers/chapter_appendix.jpg" width="70%" /></p>
|
||||
<p><img alt="附录" src="../assets/covers/chapter_appendix.jpg" width="600" /></p>
|
||||
</div>
|
||||
<h2 id="_1">本章内容<a class="headerlink" href="#_1" title="Permanent link">¶</a></h2>
|
||||
<ul>
|
||||
|
@ -3314,7 +3314,7 @@
|
||||
|
||||
<h1 id="4">4. 数组与链表<a class="headerlink" href="#4" title="Permanent link">¶</a></h1>
|
||||
<div class="center-table">
|
||||
<p><img alt="数组与链表" src="../assets/covers/chapter_array_and_linkedlist.jpg" width="70%" /></p>
|
||||
<p><img alt="数组与链表" src="../assets/covers/chapter_array_and_linkedlist.jpg" width="600" /></p>
|
||||
</div>
|
||||
<h2 id="_1">本章内容<a class="headerlink" href="#_1" title="Permanent link">¶</a></h2>
|
||||
<ul>
|
||||
|
@ -3314,7 +3314,7 @@
|
||||
|
||||
<h1 id="13">13. 回溯<a class="headerlink" href="#13" title="Permanent link">¶</a></h1>
|
||||
<div class="center-table">
|
||||
<p><img alt="回溯" src="../assets/covers/chapter_backtracking.jpg" width="70%" /></p>
|
||||
<p><img alt="回溯" src="../assets/covers/chapter_backtracking.jpg" width="600" /></p>
|
||||
</div>
|
||||
<h2 id="_1">本章内容<a class="headerlink" href="#_1" title="Permanent link">¶</a></h2>
|
||||
<ul>
|
||||
|
@ -3314,7 +3314,7 @@
|
||||
|
||||
<h1 id="2">2. 复杂度<a class="headerlink" href="#2" title="Permanent link">¶</a></h1>
|
||||
<div class="center-table">
|
||||
<p><img alt="复杂度" src="../assets/covers/chapter_complexity_analysis.jpg" width="70%" /></p>
|
||||
<p><img alt="复杂度" src="../assets/covers/chapter_complexity_analysis.jpg" width="600" /></p>
|
||||
</div>
|
||||
<h2 id="_1">本章内容<a class="headerlink" href="#_1" title="Permanent link">¶</a></h2>
|
||||
<ul>
|
||||
|
@ -3314,7 +3314,7 @@
|
||||
|
||||
<h1 id="3">3. 数据结构<a class="headerlink" href="#3" title="Permanent link">¶</a></h1>
|
||||
<div class="center-table">
|
||||
<p><img alt="数据结构" src="../assets/covers/chapter_data_structure.jpg" width="70%" /></p>
|
||||
<p><img alt="数据结构" src="../assets/covers/chapter_data_structure.jpg" width="600" /></p>
|
||||
</div>
|
||||
<h2 id="_1">本章内容<a class="headerlink" href="#_1" title="Permanent link">¶</a></h2>
|
||||
<ul>
|
||||
|
@ -3443,21 +3443,25 @@
|
||||
<p>补码的设计非常精妙,由于篇幅关系我们先介绍到这里。建议有兴趣的读者进一步深度了解。</p>
|
||||
<h2 id="332">3.3.2. 浮点数编码<a class="headerlink" href="#332" title="Permanent link">¶</a></h2>
|
||||
<p>细心的你可能会发现:<code>int</code> 和 <code>float</code> 长度相同,都是 4 bytes,但为什么 <code>float</code> 的取值范围远大于 <code>int</code> ?这非常反直觉,因为按理说 <code>float</code> 需要表示小数,取值范围应该变小才对。</p>
|
||||
<p>实际上,这是因为浮点数 <code>float</code> 采用了不同的表示方式。根据 IEEE 754 标准,32-bit 长度的 <code>float</code> 由以下部分构成:</p>
|
||||
<p>实际上,<strong>这是因为浮点数 <code>float</code> 采用了不同的表示方式</strong>。记一个 32-bit 长度的二进制数为:</p>
|
||||
<div class="arithmatex">\[
|
||||
b_{31} b_{30} b_{29} \ldots b_2 b_1 b_0
|
||||
\]</div>
|
||||
<p>根据 IEEE 754 标准,32-bit 长度的 <code>float</code> 由以下部分构成:</p>
|
||||
<ul>
|
||||
<li>符号位 <span class="arithmatex">\(\mathrm{S}\)</span> :占 1 bit 。</li>
|
||||
<li>指数位 <span class="arithmatex">\(\mathrm{E}\)</span> :占 8 bits 。</li>
|
||||
<li>分数位 <span class="arithmatex">\(\mathrm{N}\)</span> :占 24 bits ,其中 23 位显式存储。</li>
|
||||
<li>符号位 <span class="arithmatex">\(\mathrm{S}\)</span> :占 1 bit ,对应 <span class="arithmatex">\(b_{31}\)</span> 。</li>
|
||||
<li>指数位 <span class="arithmatex">\(\mathrm{E}\)</span> :占 8 bits ,对应 <span class="arithmatex">\(b_{30} b_{29} \ldots b_{23}\)</span> 。</li>
|
||||
<li>分数位 <span class="arithmatex">\(\mathrm{N}\)</span> :占 23 bits ,对应 <span class="arithmatex">\(b_{22} b_{21} \ldots b_0\)</span> 。</li>
|
||||
</ul>
|
||||
<p>设 32-bit 二进制数的第 <span class="arithmatex">\(i\)</span> 位为 <span class="arithmatex">\(b_i\)</span> ,则 <code>float</code> 值的计算方法定义为:</p>
|
||||
<p>二进制数 <code>float</code> 对应的值的计算方法:</p>
|
||||
<div class="arithmatex">\[
|
||||
\text { val } = (-1)^{b_{31}} \times 2^{\left(b_{30} b_{29} \ldots b_{23}\right)_2-127} \times\left(1 . b_{22} b_{21} \ldots b_0\right)_2
|
||||
\text {val} = (-1)^{b_{31}} \times 2^{\left(b_{30} b_{29} \ldots b_{23}\right)_2-127} \times\left(1 . b_{22} b_{21} \ldots b_0\right)_2
|
||||
\]</div>
|
||||
<p>转化到十进制下的计算公式为</p>
|
||||
<p>转化到十进制下的计算公式:</p>
|
||||
<div class="arithmatex">\[
|
||||
\text { val }=(-1)^{\mathrm{S}} \times 2^{\mathrm{E} -127} \times (1 + \mathrm{N})
|
||||
\text {val}=(-1)^{\mathrm{S}} \times 2^{\mathrm{E} -127} \times (1 + \mathrm{N})
|
||||
\]</div>
|
||||
<p>其中各项的取值范围为</p>
|
||||
<p>其中各项的取值范围:</p>
|
||||
<div class="arithmatex">\[
|
||||
\begin{aligned}
|
||||
\mathrm{S} \in & \{ 0, 1\} , \quad \mathrm{E} \in \{ 1, 2, \dots, 254 \} \newline
|
||||
|
@ -3314,7 +3314,7 @@
|
||||
|
||||
<h1 id="12">12. 分治<a class="headerlink" href="#12" title="Permanent link">¶</a></h1>
|
||||
<div class="center-table">
|
||||
<p><img alt="分治" src="../assets/covers/chapter_divide_and_conquer.jpg" width="70%" /></p>
|
||||
<p><img alt="分治" src="../assets/covers/chapter_divide_and_conquer.jpg" width="600" /></p>
|
||||
</div>
|
||||
<h2 id="_1">本章内容<a class="headerlink" href="#_1" title="Permanent link">¶</a></h2>
|
||||
<ul>
|
||||
|
@ -3314,7 +3314,7 @@
|
||||
|
||||
<h1 id="14">14. 动态规划<a class="headerlink" href="#14" title="Permanent link">¶</a></h1>
|
||||
<div class="center-table">
|
||||
<p><img alt="动态规划" src="../assets/covers/chapter_dynamic_programming.jpg" width="70%" /></p>
|
||||
<p><img alt="动态规划" src="../assets/covers/chapter_dynamic_programming.jpg" width="600" /></p>
|
||||
</div>
|
||||
<h2 id="_1">本章内容<a class="headerlink" href="#_1" title="Permanent link">¶</a></h2>
|
||||
<ul>
|
||||
|
@ -3314,7 +3314,7 @@
|
||||
|
||||
<h1 id="9">9. 图<a class="headerlink" href="#9" title="Permanent link">¶</a></h1>
|
||||
<div class="center-table">
|
||||
<p><img alt="图" src="../assets/covers/chapter_graph.jpg" width="70%" /></p>
|
||||
<p><img alt="图" src="../assets/covers/chapter_graph.jpg" width="600" /></p>
|
||||
</div>
|
||||
<h2 id="_1">本章内容<a class="headerlink" href="#_1" title="Permanent link">¶</a></h2>
|
||||
<ul>
|
||||
|
@ -3314,7 +3314,7 @@
|
||||
|
||||
<h1 id="15">15. 贪心<a class="headerlink" href="#15" title="Permanent link">¶</a></h1>
|
||||
<div class="center-table">
|
||||
<p><img alt="贪心" src="../assets/covers/chapter_greedy.jpg" width="70%" /></p>
|
||||
<p><img alt="贪心" src="../assets/covers/chapter_greedy.jpg" width="600" /></p>
|
||||
</div>
|
||||
<h2 id="_1">本章内容<a class="headerlink" href="#_1" title="Permanent link">¶</a></h2>
|
||||
<ul>
|
||||
|
@ -3314,7 +3314,7 @@
|
||||
|
||||
<h1 id="6">6. 散列表<a class="headerlink" href="#6" title="Permanent link">¶</a></h1>
|
||||
<div class="center-table">
|
||||
<p><img alt="散列表" src="../assets/covers/chapter_hashing.jpg" width="70%" /></p>
|
||||
<p><img alt="散列表" src="../assets/covers/chapter_hashing.jpg" width="600" /></p>
|
||||
</div>
|
||||
<h2 id="_1">本章内容<a class="headerlink" href="#_1" title="Permanent link">¶</a></h2>
|
||||
<ul>
|
||||
|
@ -3314,7 +3314,7 @@
|
||||
|
||||
<h1 id="8">8. 堆<a class="headerlink" href="#8" title="Permanent link">¶</a></h1>
|
||||
<div class="center-table">
|
||||
<p><img alt="堆" src="../assets/covers/chapter_heap.jpg" width="70%" /></p>
|
||||
<p><img alt="堆" src="../assets/covers/chapter_heap.jpg" width="600" /></p>
|
||||
</div>
|
||||
<h2 id="_1">本章内容<a class="headerlink" href="#_1" title="Permanent link">¶</a></h2>
|
||||
<ul>
|
||||
|
@ -3314,7 +3314,7 @@
|
||||
|
||||
<h1 id="1">1. 初识算法<a class="headerlink" href="#1" title="Permanent link">¶</a></h1>
|
||||
<div class="center-table">
|
||||
<p><img alt="初识算法" src="../assets/covers/chapter_introduction.jpg" width="70%" /></p>
|
||||
<p><img alt="初识算法" src="../assets/covers/chapter_introduction.jpg" width="600" /></p>
|
||||
</div>
|
||||
<h2 id="_1">本章内容<a class="headerlink" href="#_1" title="Permanent link">¶</a></h2>
|
||||
<ul>
|
||||
|
@ -3312,7 +3312,7 @@
|
||||
|
||||
<h1 id="0">0. 前言<a class="headerlink" href="#0" title="Permanent link">¶</a></h1>
|
||||
<div class="center-table">
|
||||
<p><img alt="前言" src="../assets/covers/chapter_preface.jpg" width="70%" /></p>
|
||||
<p><img alt="前言" src="../assets/covers/chapter_preface.jpg" width="600" /></p>
|
||||
</div>
|
||||
<h2 id="_1">本章内容<a class="headerlink" href="#_1" title="Permanent link">¶</a></h2>
|
||||
<ul>
|
||||
|
@ -3314,7 +3314,7 @@
|
||||
|
||||
<h1 id="10">10. 搜索<a class="headerlink" href="#10" title="Permanent link">¶</a></h1>
|
||||
<div class="center-table">
|
||||
<p><img alt="搜索" src="../assets/covers/chapter_searching.jpg" width="70%" /></p>
|
||||
<p><img alt="搜索" src="../assets/covers/chapter_searching.jpg" width="600" /></p>
|
||||
</div>
|
||||
<h2 id="_1">本章内容<a class="headerlink" href="#_1" title="Permanent link">¶</a></h2>
|
||||
<ul>
|
||||
|
@ -3314,7 +3314,7 @@
|
||||
|
||||
<h1 id="11">11. 排序<a class="headerlink" href="#11" title="Permanent link">¶</a></h1>
|
||||
<div class="center-table">
|
||||
<p><img alt="排序" src="../assets/covers/chapter_sorting.jpg" width="70%" /></p>
|
||||
<p><img alt="排序" src="../assets/covers/chapter_sorting.jpg" width="600" /></p>
|
||||
</div>
|
||||
<h2 id="_1">本章内容<a class="headerlink" href="#_1" title="Permanent link">¶</a></h2>
|
||||
<ul>
|
||||
|
@ -3314,7 +3314,7 @@
|
||||
|
||||
<h1 id="5">5. 栈与队列<a class="headerlink" href="#5" title="Permanent link">¶</a></h1>
|
||||
<div class="center-table">
|
||||
<p><img alt="栈与队列" src="../assets/covers/chapter_stack_and_queue.jpg" width="70%" /></p>
|
||||
<p><img alt="栈与队列" src="../assets/covers/chapter_stack_and_queue.jpg" width="600" /></p>
|
||||
</div>
|
||||
<h2 id="_1">本章内容<a class="headerlink" href="#_1" title="Permanent link">¶</a></h2>
|
||||
<ul>
|
||||
|
@ -3314,7 +3314,7 @@
|
||||
|
||||
<h1 id="7">7. 树<a class="headerlink" href="#7" title="Permanent link">¶</a></h1>
|
||||
<div class="center-table">
|
||||
<p><img alt="树" src="../assets/covers/chapter_tree.jpg" width="70%" /></p>
|
||||
<p><img alt="树" src="../assets/covers/chapter_tree.jpg" width="600" /></p>
|
||||
</div>
|
||||
<h2 id="_1">本章内容<a class="headerlink" href="#_1" title="Permanent link">¶</a></h2>
|
||||
<ul>
|
||||
|
File diff suppressed because one or more lines are too long
BIN
sitemap.xml.gz
BIN
sitemap.xml.gz
Binary file not shown.
Reference in New Issue
Block a user