mirror of
https://github.com/krahets/hello-algo.git
synced 2024-12-27 00:46:29 +08:00
build
This commit is contained in:
parent
0cd70d09d8
commit
b3686c5c2e
2 changed files with 4 additions and 4 deletions
|
@ -305,7 +305,7 @@ comments: true
|
|||
// 1. 将数组元素分配到各个桶中
|
||||
for num in nums {
|
||||
// 输入数据范围 [0, 1),使用 num * k 映射到索引范围 [0, k-1]
|
||||
let i = Int(num * k)
|
||||
let i = Int(num * Double(k))
|
||||
// 将 num 添加进桶 i
|
||||
buckets[i].append(num)
|
||||
}
|
||||
|
|
|
@ -804,7 +804,7 @@ comments: true
|
|||
pre.right = child
|
||||
else:
|
||||
# 若删除节点为根节点,则重新指定根节点
|
||||
self.__root = cur
|
||||
self.__root = child
|
||||
# 子节点数量 = 2
|
||||
else:
|
||||
# 获取中序遍历中 cur 的下一个节点
|
||||
|
@ -1136,7 +1136,7 @@ comments: true
|
|||
// 当子节点数量 = 0 / 1 时, child = null / 该子节点
|
||||
let child = cur?.left != nil ? cur?.left : cur?.right
|
||||
// 删除节点 cur
|
||||
if cur != root {
|
||||
if cur !== root {
|
||||
if pre?.left === cur {
|
||||
pre?.left = child
|
||||
} else {
|
||||
|
@ -1144,7 +1144,7 @@ comments: true
|
|||
}
|
||||
} else {
|
||||
// 若删除节点为根节点,则重新指定根节点
|
||||
root = cur;
|
||||
root = child
|
||||
}
|
||||
}
|
||||
// 子节点数量 = 2
|
||||
|
|
Loading…
Reference in a new issue