mirror of
https://github.com/krahets/hello-algo.git
synced 2026-08-10 02:50:59 +00:00
feat: add Swift codes for backtracking_algorithm article (#480)
* fix: compile error * fix: package define * feat: add Swift codes for backtracking_algorithm article
This commit is contained in:
@@ -145,7 +145,7 @@ class AVLTree {
|
||||
}
|
||||
} else {
|
||||
// 子节点数量 = 2 ,则将中序遍历的下个节点删除,并用该节点替换当前节点
|
||||
let temp = node?.right
|
||||
var temp = node?.right
|
||||
while temp?.left != nil {
|
||||
temp = temp?.left
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ class BinarySearchTree {
|
||||
// 子节点数量 = 2
|
||||
else {
|
||||
// 获取中序遍历中 cur 的下一个节点
|
||||
let tmp = cur?.right
|
||||
var tmp = cur?.right
|
||||
while tmp?.left != nil {
|
||||
tmp = tmp?.left
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user