mirror of
https://github.com/krahets/hello-algo.git
synced 2026-08-11 03:10:58 +00:00
deploy
This commit is contained in:
@@ -559,7 +559,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6 2h12v6l-4 4 4 4v6H6v-6l4-4-4-4V2m10 14.5-4-4-4 4V20h8v-3.5m-4-5 4-4V4H8v3.5l4 4M10 6h4v.75l-2 2-2-2V6Z"/></svg>
|
||||
|
||||
<span class="md-ellipsis">
|
||||
第 2 章 时空复杂度
|
||||
第 2 章 复杂度分析
|
||||
</span>
|
||||
|
||||
|
||||
@@ -574,7 +574,7 @@
|
||||
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_3_label" aria-expanded="false">
|
||||
<label class="md-nav__title" for="__nav_3">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
第 2 章 时空复杂度
|
||||
第 2 章 复杂度分析
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-scrollfix>
|
||||
|
||||
@@ -3416,7 +3416,7 @@
|
||||
<p align="center"> 图 1-2 扑克排序步骤 </p>
|
||||
|
||||
<p>上述整理扑克牌的方法本质上是“插入排序”算法,它在处理小型数据集时非常高效。许多编程语言的排序库函数中都存在插入排序的身影。</p>
|
||||
<p><strong>例三:货币找零</strong>。假设我们在超市购买了 <span class="arithmatex">\(69\)</span> 元的商品,给收银员付了 <span class="arithmatex">\(100\)</span> 元,则收银员需要找我们 <span class="arithmatex">\(31\)</span> 元。他会很自然地完成图 1-3 所示的思考。</p>
|
||||
<p><strong>例三:货币找零</strong>。假设我们在超市购买了 <span class="arithmatex">\(69\)</span> 元的商品,给了收银员 <span class="arithmatex">\(100\)</span> 元,则收银员需要找我们 <span class="arithmatex">\(31\)</span> 元。他会很自然地完成如图 1-3 所示的思考。</p>
|
||||
<ol>
|
||||
<li>可选项是比 <span class="arithmatex">\(31\)</span> 元面值更小的货币,包括 <span class="arithmatex">\(1\)</span> 元、<span class="arithmatex">\(5\)</span> 元、<span class="arithmatex">\(10\)</span> 元、<span class="arithmatex">\(20\)</span> 元。</li>
|
||||
<li>从可选项中拿出最大的 <span class="arithmatex">\(20\)</span> 元,剩余 <span class="arithmatex">\(31 - 20 = 11\)</span> 元。</li>
|
||||
@@ -3431,7 +3431,7 @@
|
||||
<p>小到烹饪一道菜,大到星际航行,几乎所有问题的解决都离不开算法。计算机的出现使我们能够通过编程将数据结构存储在内存中,同时编写代码调用 CPU 和 GPU 执行算法。这样一来,我们就能把生活中的问题转移到计算机上,以更高效的方式解决各种复杂问题。</p>
|
||||
<div class="admonition tip">
|
||||
<p class="admonition-title">Tip</p>
|
||||
<p>如果你对数据结构、算法、数组和二分查找等概念仍感到一知半解,请不要担心,继续往下阅读,这本书将引导你迈入数据结构与算法的知识殿堂。</p>
|
||||
<p>如果你对数据结构、算法、数组和二分查找等概念仍感到一知半解,请继续往下阅读,这本书将引导你迈入数据结构与算法的知识殿堂。</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -549,7 +549,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6 2h12v6l-4 4 4 4v6H6v-6l4-4-4-4V2m10 14.5-4-4-4 4V20h8v-3.5m-4-5 4-4V4H8v3.5l4 4M10 6h4v.75l-2 2-2-2V6Z"/></svg>
|
||||
|
||||
<span class="md-ellipsis">
|
||||
第 2 章 时空复杂度
|
||||
第 2 章 复杂度分析
|
||||
</span>
|
||||
|
||||
|
||||
@@ -564,7 +564,7 @@
|
||||
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_3_label" aria-expanded="false">
|
||||
<label class="md-nav__title" for="__nav_3">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
第 2 章 时空复杂度
|
||||
第 2 章 复杂度分析
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-scrollfix>
|
||||
|
||||
|
||||
@@ -559,7 +559,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6 2h12v6l-4 4 4 4v6H6v-6l4-4-4-4V2m10 14.5-4-4-4 4V20h8v-3.5m-4-5 4-4V4H8v3.5l4 4M10 6h4v.75l-2 2-2-2V6Z"/></svg>
|
||||
|
||||
<span class="md-ellipsis">
|
||||
第 2 章 时空复杂度
|
||||
第 2 章 复杂度分析
|
||||
</span>
|
||||
|
||||
|
||||
@@ -574,7 +574,7 @@
|
||||
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_3_label" aria-expanded="false">
|
||||
<label class="md-nav__title" for="__nav_3">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
第 2 章 时空复杂度
|
||||
第 2 章 复杂度分析
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-scrollfix>
|
||||
|
||||
@@ -3480,13 +3480,13 @@
|
||||
|
||||
|
||||
|
||||
<a href="../../chapter_computational_complexity/" class="md-footer__link md-footer__link--next" aria-label="下一页: 第 2 章 &nbsp; 时空复杂度" rel="next">
|
||||
<a href="../../chapter_computational_complexity/" class="md-footer__link md-footer__link--next" aria-label="下一页: 第 2 章 &nbsp; 复杂度分析" rel="next">
|
||||
<div class="md-footer__title">
|
||||
<span class="md-footer__direction">
|
||||
下一页
|
||||
</span>
|
||||
<div class="md-ellipsis">
|
||||
第 2 章 时空复杂度
|
||||
第 2 章 复杂度分析
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-footer__button md-icon">
|
||||
|
||||
@@ -610,7 +610,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6 2h12v6l-4 4 4 4v6H6v-6l4-4-4-4V2m10 14.5-4-4-4 4V20h8v-3.5m-4-5 4-4V4H8v3.5l4 4M10 6h4v.75l-2 2-2-2V6Z"/></svg>
|
||||
|
||||
<span class="md-ellipsis">
|
||||
第 2 章 时空复杂度
|
||||
第 2 章 复杂度分析
|
||||
</span>
|
||||
|
||||
|
||||
@@ -625,7 +625,7 @@
|
||||
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_3_label" aria-expanded="false">
|
||||
<label class="md-nav__title" for="__nav_3">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
第 2 章 时空复杂度
|
||||
第 2 章 复杂度分析
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-scrollfix>
|
||||
|
||||
@@ -3476,7 +3476,7 @@
|
||||
<li>图相较于链表,提供了更丰富的逻辑信息,但需要占用更大的内存空间。</li>
|
||||
</ul>
|
||||
<h2 id="123">1.2.3 数据结构与算法的关系<a class="headerlink" href="#123" title="Permanent link">¶</a></h2>
|
||||
<p>数据结构与算法高度相关、紧密结合,具体表现在图 1-4 所示的几个方面。</p>
|
||||
<p>如图 1-4 所示,数据结构与算法高度相关、紧密结合,具体表现以下三个方面。</p>
|
||||
<ul>
|
||||
<li>数据结构是算法的基石。数据结构为算法提供了结构化存储的数据,以及用于操作数据的方法。</li>
|
||||
<li>算法是数据结构发挥作用的舞台。数据结构本身仅存储数据信息,结合算法才能解决特定问题。</li>
|
||||
|
||||
Reference in New Issue
Block a user