mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-07 21:24:18 +00:00
refactor: Replace 结点 with 节点 (#452)
* Replace 结点 with 节点 Update the footnotes in the figures * Update mindmap * Reduce the size of the mindmap.png
This commit is contained in:
@@ -23,13 +23,13 @@ function linearSearchArray(nums, target) {
|
||||
function linearSearchLinkedList(head, target) {
|
||||
// 遍历链表
|
||||
while(head) {
|
||||
// 找到目标结点,返回之
|
||||
// 找到目标节点,返回之
|
||||
if(head.val === target) {
|
||||
return head;
|
||||
}
|
||||
head = head.next;
|
||||
}
|
||||
// 未找到目标结点,返回 null
|
||||
// 未找到目标节点,返回 null
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -44,4 +44,4 @@ console.log("目标元素 3 的索引 = " + index);
|
||||
/* 在链表中执行线性查找 */
|
||||
const head = arrToLinkedList(nums);
|
||||
const node = linearSearchLinkedList(head, target);
|
||||
console.log("目标结点值 3 的对应结点对象为 ", node);
|
||||
console.log("目标节点值 3 的对应节点对象为 ", node);
|
||||
|
||||
Reference in New Issue
Block a user