This commit is contained in:
krahets
2023-09-21 20:44:52 +08:00
parent 830dc9e326
commit 0ba5acd92b
111 changed files with 13161 additions and 5302 deletions
+123 -44
View File
@@ -3364,7 +3364,32 @@
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
<!--
Copyright (c) 2016-2023 Martin Donath <martin.donath@squidfunk.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
-->
<!-- Tags -->
<!-- Actions -->
<a href="https://github.com/krahets/hello-algo/tree/main/docs/chapter_greedy/summary.md" title="编辑此页" class="md-content__button md-icon">
@@ -3375,6 +3400,13 @@
<!--
Hack: check whether the content contains a h1 headline. If it doesn't, the
page title (or respectively site name) is used as the main headline.
-->
<!-- Page content -->
<h1 id="155">15.5 &nbsp; 小结<a class="headerlink" href="#155" title="Permanent link">&para;</a></h1>
<ul>
<li>贪心算法通常用于解决最优化问题,其原理是在每个决策阶段都做出局部最优的决策,以期望获得全局最优解。</li>
@@ -3389,11 +3421,73 @@
<li>在最大切分乘积问题中,我们先后推理出两个贪心策略:<span class="arithmatex">\(\geq 4\)</span> 的整数都应该继续切分、最优切分因子为 <span class="arithmatex">\(3\)</span> 。代码中包含幂运算,时间复杂度取决于幂运算实现方法,通常为 <span class="arithmatex">\(O(1)\)</span><span class="arithmatex">\(O(\log n)\)</span></li>
</ul>
<!-- Source file information -->
<!-- Was this page helpful? -->
<h2 id="__comments">评论</h2>
<!-- Previous and next pages link -->
<nav
class="md-footer__inner md-grid"
aria-label="页脚"
>
<!-- Link to previous page -->
<a
href="../max_product_cutting_problem/"
class="md-footer__link md-footer__link--prev"
aria-label="上一页: 15.4 &amp;nbsp; 最大切分乘积问题"
rel="prev"
>
<div class="md-footer__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg>
</div>
<div class="md-footer__title">
<span class="md-footer__direction">
上一页
</span>
<div class="md-ellipsis">
15.4 &nbsp; 最大切分乘积问题
</div>
</div>
</a>
<!-- Link to next page -->
<a
href="../../chapter_appendix/"
class="md-footer__link md-footer__link--next"
aria-label="下一页: 第 16 章 &amp;nbsp; 附录"
rel="next"
>
<div class="md-footer__title">
<span class="md-footer__direction">
下一页
</span>
<div class="md-ellipsis">
第 16 章 &nbsp; 附录
</div>
</div>
<div class="md-footer__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4Z"/></svg>
</div>
</a>
</nav>
<!-- Comment system -->
<h5 align="center" id="__comments">欢迎你提出疑问或建议</h5>
<!-- Insert generated snippet here -->
<script
src="https://giscus.app/client.js"
@@ -3459,48 +3553,31 @@
</main>
<footer class="md-footer">
<nav class="md-footer__inner md-grid" aria-label="页脚" >
<a href="../max_product_cutting_problem/" class="md-footer__link md-footer__link--prev" aria-label="上一页: 15.4 &amp;nbsp; 最大切分乘积问题" rel="prev">
<div class="md-footer__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg>
</div>
<div class="md-footer__title">
<span class="md-footer__direction">
上一页
</span>
<div class="md-ellipsis">
15.4 &nbsp; 最大切分乘积问题
</div>
</div>
</a>
<a href="../../chapter_appendix/" class="md-footer__link md-footer__link--next" aria-label="下一页: 第 16 章 &amp;nbsp; 附录" rel="next">
<div class="md-footer__title">
<span class="md-footer__direction">
下一页
</span>
<div class="md-ellipsis">
第 16 章 &nbsp; 附录
</div>
</div>
<div class="md-footer__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4Z"/></svg>
</div>
</a>
</nav>
<!--
Copyright (c) 2016-2023 Martin Donath <martin.donath@squidfunk.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
-->
<!-- Footer -->
<footer class="md-footer">
<!-- Further information -->
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-copyright">
@@ -3511,6 +3588,8 @@
</div>
<!-- Social links -->
<div class="md-social">