Update punctuation

This commit is contained in:
krahets
2023-08-27 23:40:39 +08:00
parent c5a7323817
commit 57851ab11e
50 changed files with 100 additions and 100 deletions
@@ -136,6 +136,6 @@
[class]{}-[func]{n_queens}
```
逐行放置 $n$ 次,考虑列约束,则从第一行到最后一行分别有 $n, n-1, \dots, 2, 1$ 个选择,**因此时间复杂度为 $O(n!)$** 。实际上,根据对角线约束的剪枝也能够大幅地缩小搜索空间,因而搜索效率往往优于以上时间复杂度。
逐行放置 $n$ 次,考虑列约束,则从第一行到最后一行分别有 $n$、$n-1$、$\dots$、$2$、$1$ 个选择,**因此时间复杂度为 $O(n!)$** 。实际上,根据对角线约束的剪枝也能够大幅地缩小搜索空间,因而搜索效率往往优于以上时间复杂度。
数组 `state` 使用 $O(n^2)$ 空间,数组 `cols` , `diags1` , `diags2` 皆使用 $O(n)$ 空间。最大递归深度为 $n$ ,使用 $O(n)$ 栈帧空间。因此,**空间复杂度为 $O(n^2)$** 。
数组 `state` 使用 $O(n^2)$ 空间,数组 `cols``diags1` `diags2` 皆使用 $O(n)$ 空间。最大递归深度为 $n$ ,使用 $O(n)$ 栈帧空间。因此,**空间复杂度为 $O(n^2)$** 。