Skip to main content
A-LevelComputer ScienceData types and structures9618/33 · Oct/Nov 2024 · Q1112 Marks

The following diagram shows an ordered binary tree. Blue Green Indigo Red Orange Violet Yellow

  1. (a)A linked list of nodes is used to store the data. Each node consists of a left pointer, the data and a right pointer. -1 is used to represent a null pointer. Complete this linked list to represent the given binary tree. RootPtr LeftPtr Data RightPtr Red Green -1 Blue -1[4]
  2. (b)A user-defined record structure is used to store the nodes of the linked list in part (a). Complete the diagram, using your answer for part (a). RootPtr Index LeftPtr Data RightPtr 0 Red 1 Green 2 Yellow 3 Blue 4 Orange 5 Indigo FreePtr 6 Violet 7[4]
  3. (c)The linked list in part (a) is implemented using a 1D array of records. Each record contains a left pointer, data and a right pointer. The following pseudocode represents a function that searches for an element in the array of records BinTree. It returns the index of the record if the element is found, or it returns a null pointer if the element is not found. Complete the pseudocode for the function. FUNCTION SearchTree(Item : STRING) NowPtr WHILE NowPtr < -1 IF NowPtr - BinTree [NowPtr].LeftPtr ELSE IF BinTree[NowPtr].Data < Item THEN ELSE RETURN NowPtr ENDIF ENDIF ENDWHILE RETURN NowPtr ENDFUNCTION[4]

This question uses a diagram from the original paper, which isn't shown here. Open the full paper from the past papers archive to see it.

Mark scheme

Marking points from the official mark scheme (Oct/Nov 2024). The mark or mark type is shown in brackets.

  1. [1] Four additional nodes with correct data values (Yellow, Orange, Indigo, Violet)
  2. [1] Correct null pointers in all added nodes (6) with no extra null pointers where the arrow points to the next node
  3. [1] Correct arrows to represent pointers joining parent nodes to child nodes
  4. [1] All nodes in correct order and no extra data added to pointers.
  5. [1] Correct Red and Green rows (Index 0: LeftPtr=1, Data=Red, RightPtr=2; Index 1: LeftPtr=3, Data=Green, RightPtr=4)
  6. [1] Correct Yellow and Blue rows (Index 2: LeftPtr=6, Data=Yellow, RightPtr=-1; Index 3: LeftPtr=-1, Data=Blue, RightPtr=-1)
  7. [1] Correct Orange, Indigo and Violet rows (Index 4: LeftPtr=5, Data=Orange, RightPtr=-1; Index 5: LeftPtr=-1, Data=Indigo, RightPtr=-1; Index 6: LeftPtr=-1, Data=Violet, RightPtr=-1)
  8. [1] Correct FreePtr with blank row 7 (FreePtr=7)
  9. [1] NowPtr ← RootPtr
  10. [1] IF BinTree[NowPtr].Data > Item THEN
  11. [1] NowPtr ← BinTree[NowPtr].LeftPtr
  12. [1] NowPtr ← BinTree[NowPtr].RightPtr
  13. [1] RETURN NowPtr (inside inner ELSE block)

Write your answer and get it marked

On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.

Sign up free →

About this question

Topic
Data types and structures, A-Level Computer Science (syllabus 9618). Structured question, 12 marks.
Source
A-Level Computer Science, Oct/Nov 2024 Paper 3 Variant 3, question 11.

Questions and mark schemes are from past examination papers and remain the copyright of the exam board. How Oracle Prep builds its content

Related Computer Science questions

© 2026 Oracle Prep