mirror of
https://github.com/krahets/hello-algo.git
synced 2024-12-25 00:26:29 +08:00
Update index.md, hashmap.md
This commit is contained in:
parent
66d0fdae30
commit
4b49373385
2 changed files with 15 additions and 11 deletions
|
@ -311,18 +311,17 @@ comments: true
|
||||||
|
|
||||||
```javascript title="hash_map.js"
|
```javascript title="hash_map.js"
|
||||||
/* 遍历哈希表 */
|
/* 遍历哈希表 */
|
||||||
// 遍历键值对 key->value
|
console.info('\n遍历键值对 Key->Value');
|
||||||
for (const entry of map.entries()) {
|
for (const [k, v] of map.entries()) {
|
||||||
if (!entry) continue;
|
console.info(k + ' -> ' + v);
|
||||||
console.info(entry.key + ' -> ' + entry.val);
|
|
||||||
}
|
}
|
||||||
// 单独遍历键 key
|
console.info('\n单独遍历键 Key');
|
||||||
for (const key of map.keys()) {
|
for (const k of map.keys()) {
|
||||||
console.info(key);
|
console.info(k);
|
||||||
}
|
}
|
||||||
// 单独遍历值 value
|
console.info('\n单独遍历值 Value');
|
||||||
for (const val of map.values()) {
|
for (const v of map.values()) {
|
||||||
console.info(val);
|
console.info(v);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,12 @@ hide:
|
||||||
|
|
||||||
<h2 align="center"> 推荐语 </h2>
|
<h2 align="center"> 推荐语 </h2>
|
||||||
|
|
||||||
|
!!! quote
|
||||||
|
|
||||||
|
“如果我当年学数据结构与算法的时候有《Hello 算法》,学起来应该会简单10倍!”
|
||||||
|
|
||||||
|
**—— 李沐,亚马逊资深首席科学家**
|
||||||
|
|
||||||
!!! quote
|
!!! quote
|
||||||
|
|
||||||
“一本通俗易懂的数据结构与算法入门书,引导读者手脑并用地学习,强烈推荐算法初学者阅读。”
|
“一本通俗易懂的数据结构与算法入门书,引导读者手脑并用地学习,强烈推荐算法初学者阅读。”
|
||||||
|
@ -79,7 +85,6 @@ hide:
|
||||||
<div class="center-table">
|
<div class="center-table">
|
||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
|
||||||
<td align="center"><a href="https://github.com/justin-tse"><img src="https://avatars.githubusercontent.com/u/24556310?v=4" width="50px;" alt="justin-tse"/><br /><sub><b>justin-tse</b></sub></a><br /><sub>JS / TS</sub></td>
|
<td align="center"><a href="https://github.com/justin-tse"><img src="https://avatars.githubusercontent.com/u/24556310?v=4" width="50px;" alt="justin-tse"/><br /><sub><b>justin-tse</b></sub></a><br /><sub>JS / TS</sub></td>
|
||||||
<td align="center"><a href="https://github.com/krahets"><img src="https://avatars.githubusercontent.com/u/26993056?v=4" width="50px;" alt="krahets"/><br /><sub><b>krahets</b></sub></a><br /><sub>Java / Python</sub></td>
|
<td align="center"><a href="https://github.com/krahets"><img src="https://avatars.githubusercontent.com/u/26993056?v=4" width="50px;" alt="krahets"/><br /><sub><b>krahets</b></sub></a><br /><sub>Java / Python</sub></td>
|
||||||
<td align="center"><a href="https://github.com/nuomi1"><img src="https://avatars.githubusercontent.com/u/3739017?v=4" width="50px;" alt="nuomi1"/><br /><sub><b>nuomi1</b></sub></a><br /><sub>Swift</sub></td>
|
<td align="center"><a href="https://github.com/nuomi1"><img src="https://avatars.githubusercontent.com/u/3739017?v=4" width="50px;" alt="nuomi1"/><br /><sub><b>nuomi1</b></sub></a><br /><sub>Swift</sub></td>
|
||||||
|
|
Loading…
Reference in a new issue