This commit is contained in:
krahets
2023-08-19 19:21:30 +08:00
parent 5884de5246
commit c2642f951c
25 changed files with 163 additions and 110 deletions

View File

@ -5010,6 +5010,7 @@
<p>相比基于前序遍历的代码实现,基于回溯算法框架的代码实现虽然显得啰嗦,但通用性更好。实际上,<strong>许多回溯问题都可以在该框架下解决</strong>。我们只需根据具体问题来定义 <code>state</code><code>choices</code> ,并实现框架中的各个方法即可。</p>
<h2 id="1314">13.1.4. &nbsp; 常用术语<a class="headerlink" href="#1314" title="Permanent link">&para;</a></h2>
<p>为了更清晰地分析算法问题,我们总结一下回溯算法中常用术语的含义,并对照例题三给出对应示例。</p>
<div class="center-table">
<table>
<thead>
<tr>
@ -5051,6 +5052,7 @@
</tr>
</tbody>
</table>
</div>
<div class="admonition tip">
<p class="admonition-title">Tip</p>
<p>问题、解、状态等概念是通用的,在分治、回溯、动态规划、贪心等算法中都有涉及。</p>

View File

@ -3508,6 +3508,8 @@
<h1 id="132">13.2. &nbsp; 全排列问题<a class="headerlink" href="#132" title="Permanent link">&para;</a></h1>
<p>全排列问题是回溯算法的一个典型应用。它的定义是在给定一个集合(如一个数组或字符串)的情况下,找出这个集合中元素的所有可能的排列。</p>
<p>下表列举了几个示例数据,包括输入数组和对应的所有排列。</p>
<p align="center"> 表:数组与链表的效率对比 </p>
<div class="center-table">
<table>
<thead>