mirror of
https://github.com/krahets/hello-algo.git
synced 2026-11-28 18:02:46 +08:00
Correct and unify doc snippets; fix errors in the demo sources (#2039)
Code snippets in the book are corrected and unified across languages and kept as literal blocks in the snippet files. The demo sources keep their #2033 form, with fixes only for real errors: wrong code, wrong printed labels, comments that contradict the code, and typos. en/ja/ko demos are rendered from the reviewed code dictionaries (krahets/hello-algo-workspace#78). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
53611a0ae9
commit
4fd605c502
@@ -9,7 +9,7 @@
|
||||
// JavaScript에는 내장 큐가 없으므로 Array를 큐로 사용할 수 있다
|
||||
const queue = [];
|
||||
|
||||
/* 큐에 원소 삽입 */
|
||||
/* 원소 삽입 */
|
||||
queue.push(1);
|
||||
queue.push(3);
|
||||
queue.push(2);
|
||||
@@ -21,7 +21,7 @@ console.log('큐 queue =', queue);
|
||||
const peek = queue[0];
|
||||
console.log('맨 앞 원소 peek =', peek);
|
||||
|
||||
/* 큐에서 원소 꺼내기 */
|
||||
/* 원소 꺼내기 */
|
||||
// 내부 자료 구조가 배열이므로 shift() 메서드의 시간 복잡도는 O(n)이다
|
||||
const pop = queue.shift();
|
||||
console.log('큐에서 꺼낸 원소 pop =', pop, ', 큐에서 꺼낸 후 queue = ', queue);
|
||||
|
||||
Reference in New Issue
Block a user