Skip to content

Commit 0f642b9

Browse files
committed
Fix: Explain const queue specifically replacing shift with push and head pointer tracking
1 parent d1989cc commit 0f642b9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Algorithm/BinaryTree/claude sonnet 4.6 extended/103. Binary Tree Zigzag Level Order Traversal/Binary_Tree_Zigzag_Level_Order_Traversal_Typescript.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ TypeScriptにおいて配列へのインデックスアクセス(例:`queue[
262262

263263
### なぜ `const``queue` を宣言するか
264264

265-
`const` は「変数自体の再代入禁止」であり、配列の中身の変更(`push` / `shift`)は許されます。これにより「`queue` という名前が別の配列に差し替えられる」バグを防ぎつつ、BFSの操作は問題なく行えます
265+
`const` は「変数自体の再代入禁止」であり、配列の中身の変更(`queue` への `push`)や、`head` ポインタ(インデックス)を進めることによる要素へのアクセスは許されます。これにより「`queue` という名前が別の配列に差し替えられる」バグを防ぎつつ、`shift` を使わないBFSループ内での操作は問題なく行えます
266266

267267
---
268268

0 commit comments

Comments
 (0)