build
This commit is contained in:
parent
ac953ef830
commit
fc3c3c6400
@ -2769,7 +2769,7 @@ comments: true
|
|||||||
// 若找到键值对,则覆盖 val 并返回
|
// 若找到键值对,则覆盖 val 并返回
|
||||||
if (hashMap->buckets[index] != NULL && hashMap->buckets[index] != hashMap->TOMBSTONE) {
|
if (hashMap->buckets[index] != NULL && hashMap->buckets[index] != hashMap->TOMBSTONE) {
|
||||||
free(hashMap->buckets[index]->val);
|
free(hashMap->buckets[index]->val);
|
||||||
hashMap->buckets[index]->val = (char *)malloc(sizeof(strlen(val + 1)));
|
hashMap->buckets[index]->val = (char *)malloc(sizeof(strlen(val) + 1));
|
||||||
strcpy(hashMap->buckets[index]->val, val);
|
strcpy(hashMap->buckets[index]->val, val);
|
||||||
hashMap->buckets[index]->val[strlen(val)] = '\0';
|
hashMap->buckets[index]->val[strlen(val)] = '\0';
|
||||||
return;
|
return;
|
||||||
@ -2777,7 +2777,7 @@ comments: true
|
|||||||
// 若键值对不存在,则添加该键值对
|
// 若键值对不存在,则添加该键值对
|
||||||
Pair *pair = (Pair *)malloc(sizeof(Pair));
|
Pair *pair = (Pair *)malloc(sizeof(Pair));
|
||||||
pair->key = key;
|
pair->key = key;
|
||||||
pair->val = (char *)malloc(sizeof(strlen(val + 1)));
|
pair->val = (char *)malloc(sizeof(strlen(val) + 1));
|
||||||
strcpy(pair->val, val);
|
strcpy(pair->val, val);
|
||||||
pair->val[strlen(val)] = '\0';
|
pair->val[strlen(val)] = '\0';
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ comments: true
|
|||||||
- **数据结构**:基本数据类型和数据结构的分类方法。数组、链表、栈、队列、哈希表、树、堆、图等数据结构的定义、优缺点、常用操作、常见类型、典型应用、实现方法等。
|
- **数据结构**:基本数据类型和数据结构的分类方法。数组、链表、栈、队列、哈希表、树、堆、图等数据结构的定义、优缺点、常用操作、常见类型、典型应用、实现方法等。
|
||||||
- **算法**:搜索、排序、分治、回溯、动态规划、贪心等算法的定义、优缺点、效率、应用场景、解题步骤和示例问题等。
|
- **算法**:搜索、排序、分治、回溯、动态规划、贪心等算法的定义、优缺点、效率、应用场景、解题步骤和示例问题等。
|
||||||
|
|
||||||
{ class="animation-figure" }
|
{ class="animation-figure" }
|
||||||
|
|
||||||
<p align="center"> 图 0-1 本书主要内容 </p>
|
<p align="center"> 图 0-1 本书主要内容 </p>
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ comments: true
|
|||||||
}
|
}
|
||||||
// 2. 统计各数字的出现次数
|
// 2. 统计各数字的出现次数
|
||||||
// counter[num] 代表 num 的出现次数
|
// counter[num] 代表 num 的出现次数
|
||||||
int *counter = calloc(m, sizeof(int));
|
int *counter = calloc(m + 1, sizeof(int));
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
counter[nums[i]]++;
|
counter[nums[i]]++;
|
||||||
}
|
}
|
||||||
|
@ -1387,6 +1387,8 @@ comments: true
|
|||||||
} else {
|
} else {
|
||||||
pre->right = child;
|
pre->right = child;
|
||||||
}
|
}
|
||||||
|
// 释放内存
|
||||||
|
free(cur);
|
||||||
} else {
|
} else {
|
||||||
/* 子节点数量 = 2 */
|
/* 子节点数量 = 2 */
|
||||||
// 获取中序遍历中 cur 的下一个节点
|
// 获取中序遍历中 cur 的下一个节点
|
||||||
|
Loading…
Reference in New Issue
Block a user