Files
hello-algo/docs/chapter_stack_and_queue/stack.assets/stack_operations.a11y.json
T
Yudong JinandClaude Opus 5.5 2c043775ac feat: add and refine screen-reader descriptions for all website figures (#2040)
* feat: preserve complete figure accessibility baseline

* feat: provide stable accessible animation state

* feat: complete reviewed figure reading candidate

* Revert the runnable-snippets batches to the #2033 state

Reverts #2034, #2035, #2036 and #2037. The work will return in a single
reviewed PR that is completed before it merges. The tree equals 8c96e2f30
(#2033).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore: bind figure descriptions to current source snippets

* chore: bind figure descriptions to the reverted snippet baseline

* refactor: keep one figure annotation source and hidden step feedback

* Keep figure annotations exclusive to website reading

* refine all figure reading descriptions after independent reader reviews

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-18 03:51:57 +08:00

111 lines
4.5 KiB
JSON

{
"schema_version": 2,
"title": "栈的入出操作",
"summary": "在栈顶同一端压入和弹出,体现先入后出(即后进先出)。",
"context": [
"所有序列按栈底到栈顶书写。push 向栈顶压入元素,pop 移除并返回栈顶元素。"
],
"description": [
"五个竖直面板从左到右由箭头串联,依次对应下表五行。每个面板上端开口为栈顶、下端封闭处为栈底;入栈箭头从上方进入,出栈箭头从上方离开。",
"虚线方块仅示意元素操作前的旧位置,不重复计入当前栈;移出容器外的实心方块表示本次 pop 的返回值。"
],
"frames": [
{
"id": "source-56",
"book_path": "chapter_stack_and_queue/stack.assets/stack_operations.png",
"title": "栈的入出操作",
"explanation": "5 先压入,4 随后压在 5 上面。每次只能弹出栈顶,所以先返回 4,再返回 5,体现先入后出,也就是后进先出。"
}
],
"animations": {
"stack-operations": {
"kind": "prose",
"prose": {
"title": "栈的入出操作",
"summary": "在栈顶同一端压入和弹出,体现先入后出(即后进先出)。",
"context": [
"所有序列按栈底到栈顶书写。push 向栈顶压入元素,pop 移除并返回栈顶元素。"
],
"description": [
"虚线方块仅示意元素操作前的旧位置,不重复计入当前栈;移出容器外的实心方块表示本次 pop 的返回值。"
],
"steps": [
{
"id": "step-1",
"title": "初始",
"explanation": "初始栈。当前栈按栈底到栈顶为 [1, 3, 2],共 3 个元素,栈底 1、栈顶 2;无返回值。",
"key_state": "初始:栈(栈底到栈顶)[1, 3, 2],栈底 1、栈顶 2,无返回值。",
"announcement": "初始栈为 [1, 3, 2],栈顶为 2。"
},
{
"id": "step-2",
"title": "push(5)",
"explanation": "执行 push(5),把 5 压到栈顶,原有元素次序不变。当前栈按栈底到栈顶为 [1, 3, 2, 5],共 4 个元素,栈底 1、栈顶 5;无返回值。",
"key_state": "push(5) 后:栈(栈底到栈顶)[1, 3, 2, 5],栈底 1、栈顶 5,无返回值。",
"announcement": "压入 5,新栈顶为 5。"
},
{
"id": "step-3",
"title": "push(4)",
"explanation": "执行 push(4),把 4 压在 5 上面,成为新栈顶。当前栈按栈底到栈顶为 [1, 3, 2, 5, 4],共 5 个元素,栈底 1、栈顶 4;无返回值。",
"key_state": "push(4) 后:栈(栈底到栈顶)[1, 3, 2, 5, 4],栈底 1、栈顶 4,无返回值。",
"announcement": "压入 4,新栈顶为 4。"
},
{
"id": "step-4",
"title": "第一次 pop()",
"explanation": "第一次执行 pop(),移除并返回栈顶 4,下方的 5 重新成为栈顶。当前栈按栈底到栈顶为 [1, 3, 2, 5],共 4 个元素,栈底 1、栈顶 5;本次返回 4,已移出栈外。",
"key_state": "第一次 pop() 后:栈(栈底到栈顶)[1, 3, 2, 5],栈底 1、栈顶 5,本次返回 4。",
"announcement": "弹出并返回栈顶 4,新栈顶为 5。"
},
{
"id": "step-5",
"title": "第二次 pop()",
"explanation": "第二次执行 pop(),移除并返回栈顶 5,栈顶恢复为 2。当前栈按栈底到栈顶为 [1, 3, 2],共 3 个元素,栈底 1、栈顶 2;本次返回 5,已移出栈外。",
"key_state": "第二次 pop() 后:栈(栈底到栈顶)[1, 3, 2],栈底 1、栈顶 2,本次返回 5。",
"announcement": "弹出并返回栈顶 5,栈恢复为 [1, 3, 2]。"
}
]
}
}
},
"tables": [
{
"caption": "栈每次操作后的内容",
"headers": [
"操作",
"有效序列(栈底到栈顶)",
"本次返回"
],
"rows": [
[
"初始",
"[1, 3, 2]",
"无"
],
[
"push(5)",
"[1, 3, 2, 5]",
"无"
],
[
"push(4)",
"[1, 3, 2, 5, 4]",
"无"
],
[
"第一次pop()",
"[1, 3, 2, 5]",
"4"
],
[
"第二次pop()",
"[1, 3, 2]",
"5"
]
],
"row_header": 0
}
]
}