mirror of
https://github.com/krahets/hello-algo.git
synced 2024-12-26 12:26:29 +08:00
build
This commit is contained in:
parent
b021b607ea
commit
60f0f80df6
4 changed files with 9 additions and 8 deletions
|
@ -317,7 +317,7 @@ comments: true
|
|||
*path = append(*path, root)
|
||||
if root.Val.(int) == 7 {
|
||||
// 记录解
|
||||
*res = append(*res, *path)
|
||||
*res = append(*res, append([]*TreeNode{}, *path...))
|
||||
}
|
||||
preOrderII(root.Left, res, path)
|
||||
preOrderII(root.Right, res, path)
|
||||
|
|
|
@ -498,7 +498,7 @@ comments: true
|
|||
|
||||
/* 负载因子 */
|
||||
func (m *hashMapChaining) loadFactor() float64 {
|
||||
return float64(m.size / m.capacity)
|
||||
return float64(m.size) / float64(m.capacity)
|
||||
}
|
||||
|
||||
/* 查询操作 */
|
||||
|
@ -523,9 +523,9 @@ comments: true
|
|||
}
|
||||
idx := m.hashFunc(key)
|
||||
// 遍历桶,若遇到指定 key ,则更新对应 val 并返回
|
||||
for _, p := range m.buckets[idx] {
|
||||
if p.key == key {
|
||||
p.val = val
|
||||
for i := range m.buckets[idx] {
|
||||
if m.buckets[idx][i].key == key {
|
||||
m.buckets[idx][i].val = val
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -1931,6 +1931,7 @@ comments: true
|
|||
// 若遇到指定 key ,则更新对应 val
|
||||
if m.buckets[j].key == key {
|
||||
m.buckets[j].val = val
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,4 +49,4 @@ comments: true
|
|||
|
||||
本书倡导手脑并用的学习方式,在这一点上深受[《动手学深度学习》](https://github.com/d2l-ai/d2l-zh)的启发。在此向各位读者强烈推荐这本优秀的著作。
|
||||
|
||||
衷心感谢我的父母,正是你们一直以来的支持与鼓励,让我有机会做这件富有趣味的事。
|
||||
**衷心感谢我的父母,正是你们一直以来的支持与鼓励,让我有机会做这件富有趣味的事**。
|
||||
|
|
|
@ -244,7 +244,7 @@ comments: true
|
|||
// 外循环:未排序区间为 [0, i]
|
||||
for (int i = size - 1; i > 0; i--) {
|
||||
// 内循环:将未排序区间 [0, i] 中的最大元素交换至该区间的最右端
|
||||
for (int j = 0; j < size - 1 - i; j++) {
|
||||
for (int j = 0; j < i; j++) {
|
||||
if (nums[j] > nums[j + 1]) {
|
||||
int temp = nums[j];
|
||||
nums[j] = nums[j + 1];
|
||||
|
@ -518,7 +518,7 @@ comments: true
|
|||
for (int i = size - 1; i > 0; i--) {
|
||||
bool flag = false;
|
||||
// 内循环:将未排序区间 [0, i] 中的最大元素交换至该区间的最右端
|
||||
for (int j = 0; j < size - 1 - i; j++) {
|
||||
for (int j = 0; j < i; j++) {
|
||||
if (nums[j] > nums[j + 1]) {
|
||||
int temp = nums[j];
|
||||
nums[j] = nums[j + 1];
|
||||
|
|
Loading…
Reference in a new issue