Publish the C codes to the docs. (#469)

This commit is contained in:
Yudong Jin
2023-04-18 20:21:31 +08:00
committed by GitHub
parent 6723cdbc7e
commit dbc4906582
29 changed files with 288 additions and 189 deletions

View File

@ -29,10 +29,12 @@ void constant(int n) {
}
}
typedef struct {
/* 哈希表 */
typedef struct hashTable {
int key;
char val[10];
UT_hash_handle hh; // 借助 uthash 实现的哈希表
int val;
// 借助 LetCode 上常用的哈希表
UT_hash_handle hh;
} hashTable;
/* 线性阶 */
@ -58,7 +60,7 @@ void linear(int n) {
for (int i = 0; i < n; i++) {
hashTable *tmp = malloc(sizeof(hashTable));
tmp->key = i;
sprintf(tmp->val, "%d", i);
tmp->val = i;
HASH_ADD_INT(h, key, tmp);
}