스택
마지막에 추가된 요소가 먼저 제거되는 LIFO 구조.
A stack is an abstract data type that serves as a collection of elements with two principal operations: 'push' (adds an element) and 'pop' (removes the most recently added element). It is essential for managing function calls, undo mechanisms, and expression parsing.
graph LR
Center["스택"]:::main
Rel_queue["queue"]:::related -.-> Center
click Rel_queue "/terms/queue"
Rel_array["array"]:::related -.-> Center
click Rel_array "/terms/array"
classDef main fill:#7c3aed,stroke:#8b5cf6,stroke-width:2px,color:white,font-weight:bold,rx:5,ry:5;
classDef pre fill:#0f172a,stroke:#3b82f6,color:#94a3b8,rx:5,ry:5;
classDef child fill:#0f172a,stroke:#10b981,color:#94a3b8,rx:5,ry:5;
classDef related fill:#0f172a,stroke:#8b5cf6,stroke-dasharray: 5 5,color:#94a3b8,rx:5,ry:5;
linkStyle default stroke:#4b5563,stroke-width:2px;
🧠 지식 테스트
1 / 1
🧒 5살도 이해할 수 있게 설명
팬케이크 더미를 생각해 보세요. 맨 위에 새 팬케이크를 올리고, 맨 위에 있는 팬케이크를 먼저 먹습니다. 마지막에 올린 것이 가장 먼저 먹힙니다!
🤓 Expert Deep Dive
스택 오버플로는 재귀 깊이가 제한을 초과할 때 발생합니다. 꼬리 호출 최적화(Tail Call Optimization)는 스택 증가를 방지합니다. Lock-free 스택(Treiber)은 동시성을 위해 원자적 연산을 사용합니다.