Computer Science (AS & A Level) · May / June 2024 · Paper 42 · Question 2
9618
As printed in the paper
The question as text
A binary tree stores data in ascending order. For example: 15 19 8 3 10 A computer program stores integers in a binary tree in ascending order. The program uses Object‑Oriented Programming (OOP). The binary tree is stored as a 1D array of nodes. Each node contains a left pointer, a data value and a right pointer. The class Node stores the data about a node. Node LeftPointer : INTEGER Data : INTEGER RightPointer : INTEGER stores the index of the node to the left in the binary tree stores the node’s data stores the index of the node to the right in the binary tree Constructor() GetLeft() GetRight() GetData() SetLeft() SetRight() SetData() initialises Data to its parameter value initialises LeftPointer and RightPointer to −1 returns the left pointer returns the right pointer returns the data value assigns the parameter to the left pointer assigns the parameter to the right pointer assigns the parameter to the data
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
2(a)(i)[4]
2(a)(ii)[3]
2(a)(iii)[3]
2(b)(i)[4]
2(b)(ii)[6]
2(b)(iii)[4]
2(c)(i)[1]
2(c)(ii)[4]
2(c)(iii)[1]
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

