Question 4(b) 2015 · October-November · Paper 41 · 62 marks
Reveal official mark-scheme answer

Official answer for Question 4
Part (b)
Part (b)
Question 1
Question 5
Question 2
Question 3
Question 4
Question 8
Question 7
Question 6
Question 9
Question 10
Question 41
Show text version of question
Question 4
Part (b)
Question 4
A binary tree Abstract Data Type (ADT) has these associated operations:
- create the tree (CreateTree)
- add an item to tree (Add)
- output items in ascending order (TraverseTree)
Part (b)
The binary tree ADT is to be implemented as an array of nodes. Each node consists of data
and two pointers.
Using pseudocode, a record type, Node, is declared as follows:
TYPE Node DECLARE Name : STRING DECLARE LeftPointer : INTEGER DECLARE RightPointer : INTEGER ENDTYPE
The statement
DECLARE Tree : ARRAY[1:10] OF Node
reserves space for 10 nodes in array Tree.
The CreateTree operation links all nodes into a linked list of free nodes. It also initialises the RootPointer and FreePointer.
Show the contents of the Tree array and the values of the two pointers, RootPointer and FreePointer, after the operations given in part
Part (a)
have been carried out.
Tree RootPointer Name LeftPointer RightPointer
FreePointer
Question 12
Why this question appears here
82% assigned-topic match · Data types and structures › Data types and records
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_w15_qp_41.pdf
