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
Stacks: แบบฝึกหัด
ข้อปรนัย 5 ข้อ ตรวจให้ทันทีที่ตอบ และข้อเขียน 5 ข้อ พร้อมวิธีทำละเอียด ทั้งหมดจากเรื่อง Stacks
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 อาจไม่ถูกต้องสมบูรณ์ในทุกกรณี กรุณาใช้เป็นสื่อเสริมและตรวจสอบกับเอกสารอ้างอิงอย่างเป็นทางการ
คุณเห็นเฉลยแล้ว ทีนี้มาตรวจคำตอบของคุณบ้าง
หน้านี้บอกได้ว่าคำตอบที่ดีเป็นอย่างไร แต่บอกไม่ได้ว่าคำตอบของคุณขาดอะไร thinka ตรวจข้อเขียนของคุณตามเกณฑ์ให้คะแนนจริงในราว 15 วินาที
อยากฝึกโจทย์แบบนี้เพิ่มไหม เริ่มฝึกหัวข้อนี้ได้เลย ตรวจให้ทันทีทุกข้อ
เริ่มฝึกเลย