diff --git a/codes/javascript/chapter_stack_and_queue/linkedlist_stack.js b/codes/javascript/chapter_stack_and_queue/linkedlist_stack.js index 9c86f905a..15707a8d3 100644 --- a/codes/javascript/chapter_stack_and_queue/linkedlist_stack.js +++ b/codes/javascript/chapter_stack_and_queue/linkedlist_stack.js @@ -1,5 +1,5 @@ /**#stkSize - * File: linkedlist_queue.js + * File: linkedlist_stack.js * Created Time: 2022-12-22 * Author: S-N-O-R-L-A-X (snorlax.xu@outlook.com) */ @@ -52,7 +52,7 @@ class LinkedListStack { return this.#stackPeek.val; } - /* 将 List 转化为 Array 并返回 */ + /* 将链表转化为 Array 并返回 */ toArray() { let node = this.#stackPeek; const res = new Array(this.size); diff --git a/codes/typescript/chapter_stack_and_queue/linkedlist_stack.ts b/codes/typescript/chapter_stack_and_queue/linkedlist_stack.ts index 0e8b46bc9..cdc487894 100644 --- a/codes/typescript/chapter_stack_and_queue/linkedlist_stack.ts +++ b/codes/typescript/chapter_stack_and_queue/linkedlist_stack.ts @@ -1,5 +1,5 @@ /** - * File: linkedlist_queue.ts + * File: linkedlist_stack.ts * Created Time: 2022-12-21 * Author: S-N-O-R-L-A-X (snorlax.xu@outlook.com) */ @@ -52,7 +52,7 @@ class LinkedListStack { return this.stackPeek.val; } - /* 将 List 转化为 Array 并返回 */ + /* 将链表转化为 Array 并返回 */ toArray(): number[] { let node = this.stackPeek; const res = new Array(this.size); diff --git a/docs/chapter_stack_and_queue/stack.md b/docs/chapter_stack_and_queue/stack.md index cbeac30f5..c8149021a 100644 --- a/docs/chapter_stack_and_queue/stack.md +++ b/docs/chapter_stack_and_queue/stack.md @@ -396,6 +396,7 @@ comments: true === "TypeScript" ```typescript title="linkedlist_stack.ts" + /* 基于链表实现的栈 */ class LinkedListStack { private stackPeek: ListNode | null; // 将头结点作为栈顶 private stkSize: number = 0; // 栈的长度 @@ -441,7 +442,7 @@ comments: true return this.stackPeek.val; } - /* 将 List 转化为 Array 并返回 */ + /* 将链表转化为 Array 并返回 */ toArray(): number[] { let node = this.stackPeek; const res = new Array(this.size);