Update docs/chapter_searching/hashing_search.md

Co-authored-by: Justin Tse <xiefahit@gmail.com>
This commit is contained in:
zhuoqinyue 2023-01-11 14:13:06 +08:00 committed by GitHub
parent 55089726d6
commit c6f6fa0015
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -173,10 +173,10 @@ comments: true
```typescript title="hashing_search.ts"
/* 哈希查找(链表) */
function hashingSearch1(map: Map<number, any>, target: number) {
function hashingSearch1(map: Map<number, ListNode>, target: number): ListNode | null {
// 哈希表的 key: 目标结点值value: 结点对象
// 若哈希表中无此 key ,返回 null
return map.has(target) ? map.get(target) : null;
return map.has(target) ? map.get(target) as ListNode : null;
}
```