This commit is contained in:
krahets
2023-07-16 04:18:52 +08:00
parent c342ba3ced
commit edcd1e5c10
21 changed files with 475 additions and 67 deletions

View File

@@ -2,7 +2,7 @@
comments: true
---
# 12.2.   全排列问题
# 13.2.   全排列问题
全排列问题是回溯算法的一个典型应用。它的定义是在给定一个集合(如一个数组或字符串)的情况下,找出这个集合中元素的所有可能的排列。
@@ -18,7 +18,7 @@ comments: true
</div>
## 12.2.1. &nbsp; 无重复的情况
## 13.2.1. &nbsp; 无重复的情况
!!! question
@@ -352,7 +352,7 @@ comments: true
<p align="center"> Fig. 全排列剪枝示例 </p>
## 12.2.2. &nbsp; 考虑重复的情况
## 13.2.2. &nbsp; 考虑重复的情况
!!! question
@@ -710,7 +710,7 @@ comments: true
<p align="center"> Fig. 两种剪枝条件的作用范围 </p>
## 12.2.3. &nbsp; 复杂度分析
## 13.2.3. &nbsp; 复杂度分析
假设元素两两之间互不相同,则 $n$ 个元素共有 $n!$ 种排列(阶乘);在记录结果时,需要复制长度为 $n$ 的列表,使用 $O(n)$ 时间。因此,**时间复杂度为 $O(n!n)$** 。