mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-31 14:23:30 +08:00
deploy
This commit is contained in:
@ -3386,7 +3386,7 @@
|
||||
<p align="center"> 图:扑克排序步骤 </p>
|
||||
|
||||
<p>上述整理扑克牌的方法本质上是“插入排序”算法,它在处理小型数据集时非常高效。许多编程语言的排序库函数中都存在插入排序的身影。</p>
|
||||
<p><strong>例三:货币找零</strong>。假设我们在超市购买了 <span class="arithmatex">\(69\)</span> 元的商品,给收银员付了 <span class="arithmatex">\(100\)</span> 元,则收银员需要找我们 <span class="arithmatex">\(31\)</span> 元。他会很自然地完成如下图所示的思考。</p>
|
||||
<p><strong>例三:货币找零</strong>。假设我们在超市购买了 <span class="arithmatex">\(69\)</span> 元的商品,给收银员付了 <span class="arithmatex">\(100\)</span> 元,则收银员需要找我们 <span class="arithmatex">\(31\)</span> 元。他会很自然地完成下图所示的思考。</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>
|
||||
@ -3401,7 +3401,7 @@
|
||||
<p>小到烹饪一道菜,大到星际航行,几乎所有问题的解决都离不开算法。计算机的出现使我们能够通过编程将数据结构存储在内存中,同时编写代码调用 CPU 和 GPU 执行算法。这样一来,我们就能把生活中的问题转移到计算机上,以更高效的方式解决各种复杂问题。</p>
|
||||
<div class="admonition tip">
|
||||
<p class="admonition-title">Tip</p>
|
||||
<p>阅读至此,如果你对数据结构、算法、数组和二分查找等概念仍感到一知半解,请继续往下阅读,因为这正是本书存在的意义。接下来,这本书将引导你一步步深入数据结构与算法的知识殿堂。</p>
|
||||
<p>如果你对数据结构、算法、数组和二分查找等概念仍感到一知半解,请不要担心,继续往下阅读,这本书将引导你迈入数据结构与算法的知识殿堂。</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user