A programmer is choosing how to implement a Stack ADT. They decide to use a dynamic data structure rather than a static one. Which of the following is a potential disadvantage of using a dynamic data structure in this context?
AQA A Level · Computer Science 7517
堆疊:練習題
5 條多項選擇題即時批改,另有 5 條文字題附完整解題步驟,全部圍繞「堆疊」。
Consider a stack implemented using a static array of size 5. Currently, the stack pointer points to index 4 (the last valid index). If a push operation is attempted, what condition is triggered?
When a subroutine is called, a stack frame is created. According to the AQA specification, what are the three primary types of data stored within this stack frame?
Which stack operation returns the value of the top element without removing it from the data structure?
A programmer needs to evaluate the expression \(12 + (3 \times 4)\) using a Stack. They first convert it to Reverse Polish Notation (RPN). What is the sequence of push and pop operations required to evaluate the resulting RPN: 12 3 4 * +?
A stack is used to reverse the order of characters in a string. If the string "AQA" is pushed onto the stack character by character from left to right, what will be the result of three consecutive pop operations?
先自己寫一次答案,再對照解題步驟。
During a Depth-First Search (DFS) on a graph, a stack is used to keep track of vertices. If the algorithm visits a vertex that has no unvisited neighbors, what specific stack operation is performed to continue the search?
先自己寫一次答案,再對照解題步驟。
When implementing a stack frame in memory for a recursive subroutine call, name three specific items that are stored on the stack to manage the execution state.
先自己寫一次答案,再對照解題步驟。
A stack is an Abstract Data Type (ADT) that follows the LIFO principle.
(a) Describe the difference between the push and pop operations.
(b) What is the purpose of a peek (or top) operation?
(c) Explain the condition known as stack overflow and when it occurs.
先自己寫一次答案,再對照解題步驟。
An expression tree is a specific type of binary tree. For the algebraic expression: \( (5 + 3) \times (8 - 2) \):
a. Determine the result of a Post-order traversal of the corresponding expression tree. (2 points)
b. Explain how a Stack is used to evaluate the resulting Reverse Polish Notation (RPN) from part a. (3 points)
c. Why does RPN eliminate the need for parentheses in complex calculations? (1 point)
先自己寫一次答案,再對照解題步驟。
* thinka提供的內容由AI生成,可能並非總是準確或最新。請將其用作輔助資源,並與官方材料進行核實。
想多做幾條同類題目?立即開始練習呢個課題,即做即批改。
立即練習