Question 5(b)(i) 2015 · May-June · Paper 43 · 59 marks
Reveal official mark-scheme answer
Official answer for Question 5
Part (b)
(i)
Show text version of question
Question 5
Part (b)
(i)
Question 5
A stack Abstract Data Type (ADT) has these associated operations:
- create stack
- add item to stack (push)
- remove item from stack (pop)
The stack ADT is to be implemented as a linked list of nodes.
Each node consists of data and a pointer to the next node. Using pseudocode, a record type, Node, is declared as follows:
TYPE Node DECLARE Name : STRING DECLARE Pointer : INTEGER ENDTYPE
The statement
DECLARE Stack : ARRAY[1:10] OF Node
reserves space for 10 nodes in array Stack.
(i)
The CreateStack operation links all nodes and initialises the TopOfStackPointer
and FreePointer.
Complete the diagram to show the value of all pointers after CreateStack has been executed.
Stack TopOfStackPointer Name Pointer
FreePointer
Question 12
Why this question appears here
91% assigned-topic match · Data types and structures › Introduction to abstract data types
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9608_s15_qp_43.pdf
