Update codes/typescript/chapter_searching/hashing_search.ts

Co-authored-by: Justin Tse <xiefahit@gmail.com>
pull/187/head
zhuoqinyue 2 years ago committed by GitHub
parent b7ff82deb5
commit 55089726d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -16,10 +16,10 @@ function hashingSearch(map: Map<number, number>, target: number) {
}
/* 哈希查找(链表) */
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;
}
function main() {

Loading…
Cancel
Save