9618/43 · May/June 2026 · Worked solutions

Step-by-step solutions based on the mark scheme (not a mark-scheme dump).

Question 1

Part 1(a) — solution

  1. DataArray = [] #15 strings

Visual Basic (VB.NET)

Dim DataArray(14) As String

Python

DataArray = [] #15 strings

Mark points

  • DataArray = [] #15 strings

Part 1(b) — solution

  1. Procedure header (and end)
  2. Taking 15 strings as input
  3. … converting to lower case
  4. … storing in array

Visual Basic (VB.NET)

Sub CreateArray()
                     For x = 0 To 14
                         Console.WriteLine("Enter a word ")
                         DataArray(x) = Console.ReadLine().ToLower()
                     Next
                  End Sub

Python

def CreateArray():
                       for x in range(15):
                           DataArray.append(input("Enter a word ").lower())

Mark points

  • Procedure header (and end)
  • Taking 15 strings as input
  • … converting to lower case
  • … storing in array

Part 1(c) — solution

  1. Procedure header (and end) and outputting all data
  2. … on one line with a space between each element

Visual Basic (VB.NET)

Sub OutputArray()
                      Dim StringOutput As String = ""
                      For x = 0 To 14
                          StringOutput = StringOutput + " " + DataArray(x)
                      Next
                      Console.WriteLine(StringOutput)
                  End Sub

Python

def OutputArray():
                       StringOutput = ""
                       for x in range(15):
                           StringOutput = StringOutput + " " + DataArray[x]
                       print(StringOutput)

Mark points

  • Procedure header (and end) and outputting all data
  • … on one line with a space between each element

Part 1(d)(i) — solution

1 mark for calling both procedures in the given order 1 Example program code Python CreateArray() OutputArray() VB.NET CreateArray() OutputArray()

Visual Basic (VB.NET)

CreateArray()
                  OutputArray()

Python

CreateArray()
                  OutputArray()

Mark points

  • Include the ideas shown in the solution above.

Part 1(d)(ii) — solution

1 mark for showing the 15 inputs and all data output on the same line 1 Outputs must be lowercase e.g. University Press & Assessment 2026 Page 9 of 46 Trace ID: PC-BEC0C4D104 Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable. Licensed for hosting on papacambridge.com only. PapaCambridge 9618/43 Mark Scheme June · papacambridge.com 2026 | Source: papacambridge.com 9618/43 Mark Scheme June 2026 Downloaded from PapaCambridge - https://papacambridge.com/ 9618/43 Cambridge International AS & A Level – Mark Scheme May/June 2026 Guidance

Mark points

  • Include the ideas shown in the solution above.

Part 1(e) — solution

  1. Procedure header (and end) taking string as input and converting to lower
  2. Looping through all elements in the array
  3. … comparing to input
  4. … counting number of times it occurs
  5. Outputting final count

Visual Basic (VB.NET)

Sub FindWords()
                        Console.WriteLine("Enter the word you want to find")
                        Dim WordFind As String = Console.ReadLine().ToLower()
                        Dim Counter As Integer = 0
                        For x = 0 To 14
                            If DataArray(x) = WordFind Then
                                Counter = Counter + 1
                            End If
                        Next
                        Console.WriteLine("It was found " & Counter & " times")
                    End Sub

Python

def FindWords():
                       WordFind = input("Enter the word you want to find ").lower()
                       Counter = 0
                       for x in range(15):
                           if(DataArray[x] == WordFind):
                                Counter = Counter + 1
                       print("It was found ", Counter, " times")

Mark points

  • Procedure header (and end) taking string as input and converting to lower
  • Looping through all elements in the array
  • … comparing to input
  • … counting number of times it occurs
  • Outputting final count

Part 1(f)(i) — solution

  1. Procedure header (and end) and iterating through each element (first loop)
  2. Inner loop
  3. Stopping the loop when in order (any method)
  4. Comparing by length …
  5. … and swapping correctly

Visual Basic (VB.NET)

Sub SortLength()
                      Dim Temp As String
                      Dim Swap As Boolean = True
                      Dim Count As Integer = 0
                      While Count < 15 And Swap = True
                          Swap = False
                          For y = 0 To 13
                              If DataArray(y).Length > DataArray(y + 1).Length Then
                                  Temp = DataArray(y)
                                  DataArray(y) = DataArray(y + 1)
                                  DataArray(y + 1) = Temp
                                  Swap = True
                              End If
                          Next
                          Count = Count + 1
                      End While
                  End Sub

                University Press & Assessment 2026                                                                       Page 13 of 46

Trace ID: PC-BEC0C4D104
Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable.
Licensed for hosting on papacambridge.com only.
PapaCambridge
9618/43 Mark  Scheme June ·     papacambridge.com
                             2026 | Source:    papacambridge.com                                                                                    9618/43 Mark Scheme June 2026
Downloaded from PapaCambridge - https://papacambridge.com/

               9618/43                                                                                          Cambridge International AS & A Level – Mark Scheme                          May/June 2026

                     Guidance

Python

def SortLength():
                       Swap = True
                       Count = 0

                                 while(Count < 14 and Swap):
                                     Swap = False
                                     for y in range(14):
                                         if(len(DataArray[y]) > len(DataArray[y+1])):
                                             DataArray[y], DataArray[y+1] = DataArray[y+1], DataArray[y]
                                             Swap = True
                                     Count = Count + 1

Mark points

  • Procedure header (and end) and iterating through each element (first loop)
  • Inner loop
  • Stopping the loop when in order (any method)
  • Comparing by length …
  • … and swapping correctly

Part 1(f)(ii) — solution

1 mark for calling the 3 procedures in order 1 Example program code Python FindWords() SortLength() OutputArray() VB.NET FindWords() SortLength() OutputArray()

Visual Basic (VB.NET)

FindWords()
                  SortLength()
                  OutputArray()

Python

FindWords()
                  SortLength()
                  OutputArray()

Mark points

  • Include the ideas shown in the solution above.

Part 1(f)(iii) — solution

1 mark for screenshot showing inputs and outputs 1 Ignore output of array content in order first. Allow ordering if correct for the data but not matching screenshot. e.g. University Press & Assessment 2026 Page 15 of 46 Trace ID: PC-BEC0C4D104 Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable. Licensed for hosting on papacambridge.com only. PapaCambridge 9618/43 Mark Scheme June · papacambridge.com 2026 | Source: papacambridge.com 9618/43 Mark Scheme June 2026 Downloaded from PapaCambridge - https://papacambridge.com/ 9618/43 Cambridge International AS & A Level – Mark Scheme May/June 2026 Guidance

Mark points

  • Include the ideas shown in the solution above.

Question 2

Part 2(a)(i) — solution

  1. Class header (and end)
  2. Five attributes with the correct data types
  3. Constructor header (and end) taking five parameters
  4. Assigning parameters to each attribute

Visual Basic (VB.NET)

Class Character
                       Dim CharacterName As String
                       Dim Colour As String
                       Dim SuperStrength As String
                       Dim Fly As String
                       Dim Invisible As String

                                     Public Sub New(pCharacterName, pColour, pSuperStrength, pFly, pInvisible)
                                         CharacterName = pCharacterName
                                         Colour = pColour
                                         SuperStrength = pSuperStrength
                                         Fly = pFly
                                         Invisible = pInvisible
                                     End Sub

                  End Class

                University Press & Assessment 2026                                                                       Page 16 of 46

Trace ID: PC-BEC0C4D104
Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable.
Licensed for hosting on papacambridge.com only.
PapaCambridge
9618/43 Mark  Scheme June ·     papacambridge.com
                             2026 | Source:    papacambridge.com                                                                                    9618/43 Mark Scheme June 2026
Downloaded from PapaCambridge - https://papacambridge.com/

               9618/43                                                                                          Cambridge International AS & A Level – Mark Scheme                          May/June 2026

                     Guidance

Python

class Character():
                       def __init__(self, pCharacterName, pColour, pSuperStrength, pFly, pInvisible):
                           self.__CharacterName = pCharacterName
                           self.__Colour = pColour
                           self.__SuperStrength = pSuperStrength
                           self.__Fly = pFly
                           self.__Invisible = pInvisible

Mark points

  • Class header (and end)
  • Five attributes with the correct data types
  • Constructor header (and end) taking five parameters
  • Assigning parameters to each attribute

Part 2(a)(ii) — solution

  1. 1 get method header (and end) with no parameter
  2. … returning correct attribute
  3. Remaining 4 get methods correct

Visual Basic (VB.NET)

Public Function GetCharacterName()
                      Return CharacterName
                  End Function
                  Public Function GetColour()
                      Return Colour
                  End Function
                  Public Function GetSuperStrength()
                      Return SuperStrength
                  End Function
                  Public Function GetFly()
                      Return Fly
                  End Function
                  Public Function GetInvisible()
                      Return Invisible
                  End Function

                University Press & Assessment 2026                                                                       Page 18 of 46

Trace ID: PC-BEC0C4D104
Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable.
Licensed for hosting on papacambridge.com only.
PapaCambridge
9618/43 Mark  Scheme June ·     papacambridge.com
                             2026 | Source:    papacambridge.com                                                                                    9618/43 Mark Scheme June 2026
Downloaded from PapaCambridge - https://papacambridge.com/

               9618/43                                                                                          Cambridge International AS & A Level – Mark Scheme                          May/June 2026

                     Guidance

Python

def GetCharacterName(self):
                           return self.__CharacterName
                       def GetColour(self):
                           return self.__Colour
                       def GetSuperStrength(self):
                           return self.__SuperStrength
                       def GetFly(self):
                           return self.__Fly
                       def GetInvisible(self):
                           return self.__Invisible

Mark points

  • 1 get method header (and end) with no parameter
  • … returning correct attribute
  • Remaining 4 get methods correct

Part 2(b) — solution

  1. ReadData() header (and end) returning populated array
  2. Opening file to read and closing file in appropriate place
  3. Exception handling for file handling including appropriate output
  4. Looping through each line in file and reading data…
  5. … (stripping and) splitting file correctly (as appropriate)
  6. Creating new instance of Character with correct values …
  7. … storing in array

Visual Basic (VB.NET)

Public Function ReadData()
                      Dim AllCharacters(14) As Character
                      Dim Line(4) As String
                      Dim Count As Integer = 0

                                 Try
                                                Dim FileReader As New System.IO.StreamReader("Characters.txt")
                                                While Not FileReader.EndOfStream

                                                               Line = (FileReader.ReadLine()).Split(",")
                                                               AllCharacters(Count) = New Character(Line(0), Line(1), Line(2), Line(3), Line(4))

                                                    Count = Count + 1
                                                End While
                                                FileReader.Close()

                      Catch ex As Exception
                          Console.WriteLine("Cannot open or read from file")
                      End Try
                      Return AllCharacters
                  End Function

                University Press & Assessment 2026                                                                       Page 21 of 46

Trace ID: PC-BEC0C4D104
Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable.
Licensed for hosting on papacambridge.com only.
PapaCambridge
9618/43 Mark  Scheme June ·     papacambridge.com
                             2026 | Source:    papacambridge.com                                                                                    9618/43 Mark Scheme June 2026
Downloaded from PapaCambridge - https://papacambridge.com/

               9618/43                                                                                          Cambridge International AS & A Level – Mark Scheme                          May/June 2026

                     Guidance

Python

def ReadData():
                       AllCharacters = []
                       try:
                           with open("Characters.txt") as TheFile:
                                for Line in TheFile:
                                     Line = Line.strip()
                                     Line = Line.split(",")
                                     AllCharacters.append(Character(Line[0],Line[1],Line[2],Line[3],Line[4]))
                       except:
                           print("Cannot open file")
                       return AllCharacters

Mark points

  • ReadData() header (and end) returning populated array
  • Opening file to read and closing file in appropriate place
  • Exception handling for file handling including appropriate output
  • Looping through each line in file and reading data…
  • … (stripping and) splitting file correctly (as appropriate)
  • Creating new instance of Character with correct values …
  • … storing in array

Part 2(c) — solution

  1. Procedure header (and end) taking array parameter and outputting character data using get
  2. Looping through all characters and outputting data on same line …
  3. … in correct format

Visual Basic (VB.NET)

Public Sub OutputCharacters(CharacterArray() As Character)
                      Dim Count As Integer = 0

                      While (Not (CharacterArray(Count) Is Nothing))
                          Console.WriteLine("Name: " & CharacterArray(Count).GetCharacterName() & " Colour: " &
                  CharacterArray(Count).GetColour() & " Super strength: " & CharacterArray(Count).GetSuperStrength() & " Fly:
                  " & CharacterArray(Count).GetFly() & " Invisible: " & CharacterArray(Count).GetInvisible())
                          Count = Count + 1
                      End While

                  End Sub

Python

def OutputCharacters(CharacterArray):
                       for Item in CharacterArray:
                           print("Name: ", Item.GetCharacterName(), " Colour: ", Item.GetColour(), " Super Strength: ",
                  Item.GetSuperStrength(), " Fly: ", Item.GetFly(), " Invisible: ", Item.GetInvisible())

Mark points

  • Procedure header (and end) taking array parameter and outputting character data using get
  • Looping through all characters and outputting data on same line …
  • … in correct format

Part 2(d)(i) — solution

  1. Calling ReadData() and storing returned array
  2. Calling OutputCharacters() with returned array

Visual Basic (VB.NET)

Dim CharacterOptions(19) As Character
                  CharacterOptions = ReadData()
                  OutputCharacters(CharacterOptions)

Python

CharacterOptions = ReadData()
                  OutputCharacters(CharacterOptions)

Mark points

  • Calling ReadData() and storing returned array
  • Calling OutputCharacters() with returned array

Part 2(d)(ii) — solution

1 mark for screenshot showing all characters output (in correct format) 1 e.g. University Press & Assessment 2026 Page 25 of 46 Trace ID: PC-BEC0C4D104 Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable. Licensed for hosting on papacambridge.com only. PapaCambridge 9618/43 Mark Scheme June · papacambridge.com 2026 | Source: papacambridge.com 9618/43 Mark Scheme June 2026 Downloaded from PapaCambridge - https://papacambridge.com/ 9618/43 Cambridge International AS & A Level – Mark Scheme May/June 2026 Guidance

Mark points

  • Include the ideas shown in the solution above.

Part 2(e)(i) — solution

  1. Prompt and input for two criteria …
  2. … taking input as two separate inputs // each in one input and splitting appropriately
  3. Looping through each character and comparing attribute to one choice…
  4. … repeating for a second choice … (could be AND in if statement)
  5. … storing matching characters in new array // removing characters from the list // other
  6. Counting and outputting the number of characters
  7. Calling OutputCharacters() with updated array
  8. Using get methods correctly throughout

Visual Basic (VB.NET)

Console.WriteLine("You can use 2 choices to limit the characters available")
                  Dim TheOption As String
                  Dim Choice As String
                  Dim Count As Integer
                  Dim TempCount As Integer

                University Press & Assessment 2026                                                                       Page 28 of 46

Trace ID: PC-BEC0C4D104
Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable.
Licensed for hosting on papacambridge.com only.
PapaCambridge
9618/43 Mark  Scheme June ·     papacambridge.com
                             2026 | Source:    papacambridge.com                                                                                    9618/43 Mark Scheme June 2026
Downloaded from PapaCambridge - https://papacambridge.com/

               9618/43                                                                                          Cambridge International AS & A Level – Mark Scheme                          May/June 2026

                     Guidance

                  For x = 1 To 2
                      Dim TempArray(20) As Character
                      TempCount = 0

                                 Console.WriteLine("Choice " & x)
                                 Console.WriteLine("Enter 1 to select a colour, 2 for strength, 3 for fly and 4 for invisibility ")
                                 TheOption = Console.ReadLine()

                                 If TheOption = "1" Then
                                     Console.WriteLine("Which colour would you like to select a character ")
                                     Choice = Console.ReadLine()
                                     Count = 0

                                                While (Not (CharacterOptions(Count) Is Nothing))
                                                    If (CharacterOptions(Count).GetColour() = Choice) Then
                                                        TempArray(TempCount) = CharacterOptions(Count)
                                                        TempCount = TempCount + 1
                                                    End If
                                                    Count = Count + 1
                                                End While
                                                CharacterOptions = TempArray

                      ElseIf TheOption = "2" Then
                          Console.WriteLine("Enter 1 to select characters with super strength, anything else for those
                  without select super strength ")
                          Choice = Console.ReadLine()
                          Count = 0
                          If Choice = "1" Then
                              Choice = "Yes"
                          Else
                              Choice = "No"
                          End If

                University Press & Assessment 2026                                                                       Page 29 of 46

Trace ID: PC-BEC0C4D104
Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable.
Licensed for hosting on papacambridge.com only.
PapaCambridge
9618/43 Mark  Scheme June ·     papacambridge.com
                             2026 | Source:    papacambridge.com                                                                                    9618/43 Mark Scheme June 2026
Downloaded from PapaCambridge - https://papacambridge.com/

               9618/43                                                                                          Cambridge International AS & A Level – Mark Scheme                          May/June 2026

                     Guidance

                                                While (Not (CharacterOptions(Count) Is Nothing))
                                                    If (CharacterOptions(Count).GetSuperStrength() = Choice) Then
                                                        TempArray(TempCount) = CharacterOptions(Count)
                                                        TempCount = TempCount + 1
                                                    End If
                                                    Count = Count + 1
                                                End While
                                                CharacterOptions = TempArray

                                 ElseIf TheOption = "3" Then
                                     Console.WriteLine("Enter 1 to select characters that fly, anything else for those that cannot fly
                  ")
                                                Choice = Console.ReadLine()
                                                Count = 0
                                                If Choice = "1" Then
                                                    Choice = "Yes"
                                                Else
                                                    Choice = "No"
                                                End If
                                                While (Not (CharacterOptions(Count) Is Nothing))
                                                    If (CharacterOptions(Count).GetFly() = Choice) Then
                                                        TempArray(TempCount) = CharacterOptions(Count)
                                                        TempCount = TempCount + 1
                                                    End If
                                                    Count = Count + 1
                                                End While
                                                CharacterOptions = TempArray

                      Else
                          Console.WriteLine("Enter 1 to select characters with invisibility, anything else for those without
                  invisibility ")
                          Choice = Console.ReadLine()
                          Count = 0

                University Press & Assessment 2026                                                                       Page 30 of 46

Trace ID: PC-BEC0C4D104
Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable.
Licensed for hosting on papacambridge.com only.
PapaCambridge
9618/43 Mark  Scheme June ·     papacambridge.com
                             2026 | Source:    papacambridge.com                                                                                    9618/43 Mark Scheme June 2026
Downloaded from PapaCambridge - https://papacambridge.com/

               9618/43                                                                                          Cambridge International AS & A Level – Mark Scheme                          May/June 2026

                     Guidance

                                     If Choice = "1" Then
                                         Choice = "Yes"
                                     Else
                                         Choice = "No"
                                     End If
                                     While (Not (CharacterOptions(Count) Is Nothing))
                                         If (CharacterOptions(Count).GetInvisible() = Choice) Then
                                             TempArray(TempCount) = CharacterOptions(Count)
                                             TempCount = TempCount + 1
                                         End If
                                         Count = Count + 1
                                     End While
                                     CharacterOptions = TempArray
                                 End If

                  Next
                  Console.WriteLine("There are " & TempCount & " characters")
                  OutputCharacters(CharacterOptions)

Python

print("You can use 2 choices to limit the characters available")
                  for x in range(2):
                       TempArray = []
                       print("Choice ", x+1)
                       TheOption = int(input("Enter 1 to select a colour, 2 for strength, 3 for fly and 4 for invisibility "))

                                 if(TheOption == 1):
                                     Choice = input("Which colour would you like to select a character ")
                                     for Item in CharacterOptions:
                                         if Item.GetColour() == Choice:
                                             TempArray.append(Item)
                                     CharacterOptions = TempArray

                      elif TheOption == 2:
                          Choice = input("Enter 1 to select characters with super strength, anything else for those without
                  select super strength ")
                          if Choice == "1":
                              Choice = "Yes"
                          else:
                              Choice = "No"
                          for Item in CharacterOptions:
                              if Item.GetSuperStrength() == Choice:
                                  TempArray.append(Item)
                          CharacterOptions = TempArray

                                 elif TheOption == 3:
                                     Choice = input("Enter 1 to select characters that fly, anything else for those that cannot fly ")
                                     if Choice == "1":
                                         Choice = "Yes"

                University Press & Assessment 2026                                                                       Page 27 of 46

Trace ID: PC-BEC0C4D104
Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable.
Licensed for hosting on papacambridge.com only.
PapaCambridge
9618/43 Mark  Scheme June ·     papacambridge.com
                             2026 | Source:    papacambridge.com                                                                                    9618/43 Mark Scheme June 2026
Downloaded from PapaCambridge - https://papacambridge.com/

               9618/43                                                                                          Cambridge International AS & A Level – Mark Scheme                          May/June 2026

                     Guidance

                                                else:
                                                    Choice = "No"
                                                for Item in CharacterOptions:

                                                               if Item.GetFly() == Choice:

                                                        TempArray.append(Item)
                                                CharacterOptions = TempArray

                      else:
                          Choice = int(input("Enter 1 to select characters with invisibility, anything else for those without
                  invisibility "))
                          if Choice == "1":
                              Choice = "Yes"
                          else:
                              Choice = "No"
                          for Item in CharacterOptions:
                              if Item.GetInvisible() == Choice:
                                  TempArray.append(Item)
                          CharacterOptions = TempArray

                  NumberCharacters = len(CharacterOptions)
                  print("There are", NumberCharacters, "characters that match your choice")
                  OutputCharacters(CharacterOptions)

Mark points

  • Prompt and input for two criteria …
  • … taking input as two separate inputs // each in one input and splitting appropriately
  • Looping through each character and comparing attribute to one choice…
  • … repeating for a second choice … (could be AND in if statement)
  • … storing matching characters in new array // removing characters from the list // other
  • Counting and outputting the number of characters
  • Calling OutputCharacters() with updated array
  • Using get methods correctly throughout

Part 2(e)(ii) — solution

1 mark for screenshot showing correct inputs and outputs 1 e.g. University Press & Assessment 2026 Page 34 of 46 Trace ID: PC-BEC0C4D104 Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable. Licensed for hosting on papacambridge.com only. PapaCambridge 9618/43 Mark Scheme June · papacambridge.com 2026 | Source: papacambridge.com 9618/43 Mark Scheme June 2026 Downloaded from PapaCambridge - https://papacambridge.com/ 9618/43 Cambridge International AS & A Level – Mark Scheme May/June 2026 Guidance

Mark points

  • Include the ideas shown in the solution above.

Question 3

Part 3(a) — solution

  1. Global array with space for 100  3 elements …
  2. … all initialised to –1
  3. TreeRootPointer to –1 and FirstFreeNodePointer initialised to 0

Visual Basic (VB.NET)

Dim BinaryTree(100, 3) As Integer
                   Dim FirstFreeNodePointer As Integer
                   Dim TreeRootPointer As Integer
                  Sub Main()
                          For x = 0 To 99
                              BinaryTree(x, 0) = -1
                              BinaryTree(x, 1) = -1
                              BinaryTree(x, 2) = -1
                          Next
                          TreeRootPointer = -1
                          FirstFreeNodePointer = 0
                  End Sub

Python

for x in range(100):
                       BinaryTree.append([-1,-1,-1])
                  TreeRootPointer = -1
                  FirstFreeNodePointer = 0

Mark points

  • Global array with space for 100  3 elements …
  • … all initialised to –1
  • TreeRootPointer to –1 and FirstFreeNodePointer initialised to 0

Part 3(b) — solution

  1. Procedure header (and end) take integer parameter and incrementing FirstFreeNodePointer
  2. Checking if tree is empty, storing in first element and updating root pointer
  3. Checking if the tree is full and outputting message
  4. (if not full) stores the data in FirstFreeNodePointer with parameter (and pointers –1)
  5. Comparing to root pointer …
  6. … repeating with left pointer if less than
  7. … repeating with right pointer if greater than
  8. … repeating until leaf node found …
  9. … updating correct parent node pointer to new node

Visual Basic (VB.NET)

Sub AddNode(NodeData)
                       If FirstFreeNodePointer <= 99 Then
                           BinaryTree(FirstFreeNodePointer, 0) = -1
                           BinaryTree(FirstFreeNodePointer, 1) = NodeData
                           BinaryTree(FirstFreeNodePointer, 2) = -1

                                                    If (TreeRootPointer = -1) Then
                                                        TreeRootPointer = 0
                                                    Else
                                                        Dim Placed As Boolean = False
                                                        Dim CurrentNode As Integer = TreeRootPointer

                               While (Placed = False)
                                   If (NodeData < BinaryTree(CurrentNode, 1)) Then
                                       If (BinaryTree(CurrentNode, 0) = -1) Then
                                           BinaryTree(CurrentNode, 0) = FirstFreeNodePointer
                                           Placed = True
                                       Else
                                           CurrentNode = BinaryTree(CurrentNode, 0)
                                       End If
                                   Else
                                       If (BinaryTree(CurrentNode, 2) = -1) Then
                                           BinaryTree(CurrentNode, 2) = FirstFreeNodePointer
                                           Placed = True
                                       Else
                                           CurrentNode = BinaryTree(CurrentNode, 2)
                                       End If
                                   End If
                               End While
                           End If
                           FirstFreeNodePointer = FirstFreeNodePointer + 1
                       Else
                           Console.WriteLine("The tree is full")
                       End If
                  End Sub

                University Press & Assessment 2026                                                                       Page 38 of 46

Trace ID: PC-BEC0C4D104
Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable.
Licensed for hosting on papacambridge.com only.
PapaCambridge
9618/43 Mark  Scheme June ·     papacambridge.com
                             2026 | Source:    papacambridge.com                                                                                    9618/43 Mark Scheme June 2026
Downloaded from PapaCambridge - https://papacambridge.com/

               9618/43                                                                                          Cambridge International AS & A Level – Mark Scheme                          May/June 2026

                     Guidance

Python

def AddNode(NodeData):
                       global FirstFreeNodePointer
                       global TreeRootPointer
                       if FirstFreeNodePointer <= 99:

                                                BinaryTree[FirstFreeNodePointer][0] = -1
                                                BinaryTree[FirstFreeNodePointer][1] = NodeData
                                                BinaryTree[FirstFreeNodePointer][2] = -1

                                                if TreeRootPointer == -1:
                                                    TreeRootPointer = 0
                                                else:
                                                    Placed = False
                                                    CurrentNode = TreeRootPointer
                                                    while Placed == False:

                                             if NodeData < BinaryTree[CurrentNode][1]:
                                                 if BinaryTree[CurrentNode][0] == -1:
                                                     BinaryTree[CurrentNode][0] = FirstFreeNodePointer
                                                     Placed = True
                                                 else:
                                                     CurrentNode = BinaryTree[CurrentNode][0]
                                             else:
                                                 if BinaryTree[CurrentNode][2] == -1:
                                                     BinaryTree[CurrentNode][2] = FirstFreeNodePointer
                                                     Placed = True
                                                 else:
                                                     CurrentNode = BinaryTree[CurrentNode][2]
                                     FirstFreeNodePointer = FirstFreeNodePointer + 1
                                 else:
                                     print("The tree is full")

                University Press & Assessment 2026                                                                       Page 37 of 46

Trace ID: PC-BEC0C4D104
Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable.
Licensed for hosting on papacambridge.com only.
PapaCambridge
9618/43 Mark  Scheme June ·     papacambridge.com
                             2026 | Source:    papacambridge.com                                                                                    9618/43 Mark Scheme June 2026
Downloaded from PapaCambridge - https://papacambridge.com/

               9618/43                                                                                          Cambridge International AS & A Level – Mark Scheme                          May/June 2026

                     Guidance

Mark points

  • Procedure header (and end) take integer parameter and incrementing FirstFreeNodePointer
  • Checking if tree is empty, storing in first element and updating root pointer
  • Checking if the tree is full and outputting message
  • (if not full) stores the data in FirstFreeNodePointer with parameter (and pointers –1)
  • Comparing to root pointer …
  • … repeating with left pointer if less than
  • … repeating with right pointer if greater than
  • … repeating until leaf node found …
  • … updating correct parent node pointer to new node

Part 3(c) — solution

  1. Procedure header (and end) looping 10 times
  2. Outputting array data in correct format

Visual Basic (VB.NET)

Sub OutputArray()
                           For x = 0 To 9
                               Console.WriteLine(BinaryTree(x, 0) & "    " & BinaryTree(x, 1) & "    " & BinaryTree(x, 2))
                           Next
                       End Sub

Python

def OutputArray():
                       for x in range(10):
                           print(BinaryTree[x][0], "                                                                ", BinaryTree[x][1], "               ", BinaryTree[x][2])

Mark points

  • Procedure header (and end) looping 10 times
  • Outputting array data in correct format

Part 3(d)(i) — solution

  1. Taking 10 numbers as input …
  2. … calling AddNode() with each value
  3. Calling OutputArray()

Visual Basic (VB.NET)

For x = 0 To 9
                                                    Console.WriteLine("Enter a number")
                                                    AddNode(Console.ReadLine())
                                                Next
                                                OutputArray()

Python

for x in range(10):
                       AddNode(int(input("Enter a number ")))
                  OutputArray()

Mark points

  • Taking 10 numbers as input …
  • … calling AddNode() with each value
  • Calling OutputArray()

Part 3(d)(ii) — solution

1 mark for screenshot show array contents 1 e.g. University Press & Assessment 2026 Page 42 of 46 Trace ID: PC-BEC0C4D104 Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable. Licensed for hosting on papacambridge.com only. PapaCambridge 9618/43 Mark Scheme June · papacambridge.com 2026 | Source: papacambridge.com 9618/43 Mark Scheme June 2026 Downloaded from PapaCambridge - https://papacambridge.com/ 9618/43 Cambridge International AS & A Level – Mark Scheme May/June 2026 Guidance

Mark points

  • Include the ideas shown in the solution above.

Part 3(e)(i) — solution

  1. Recursive procedure InOrder() header and end with parameter
  2. Checking if left pointer is null …
  3. … if not, recursive call with left pointer
  4. Outputting data at parameter
  5. Checking if right pointer is null …
  6. … if not, recursive call with right pointer
  7. Correct order

Visual Basic (VB.NET)

Sub InOrder(TheRoot)
                                     If (BinaryTree(TheRoot, 0) <> -1) Then
                                         InOrder(BinaryTree(TheRoot, 0))
                                     End If
                                     Console.WriteLine(BinaryTree(TheRoot, 1))
                                     If (BinaryTree(TheRoot, 2) <> -1) Then
                                         InOrder(BinaryTree(TheRoot, 2))
                                     End If
                                 End Sub

Python

def InOrder(TheRoot):
                       if(BinaryTree[TheRoot][0] != -1):
                           InOrder(BinaryTree[TheRoot][0])
                       print(BinaryTree[TheRoot][1])
                       if(BinaryTree[TheRoot][2] != -1):
                           InOrder(BinaryTree[TheRoot][2])

Mark points

  • Recursive procedure InOrder() header and end with parameter
  • Checking if left pointer is null …
  • … if not, recursive call with left pointer
  • Outputting data at parameter
  • Checking if right pointer is null …
  • … if not, recursive call with right pointer
  • Correct order

Part 3(e)(ii) — solution

1 mark for calling InOrder() with root pointer 1 Example program code Python InOrder(TreeRootPointer) VB.NET InOrder(TreeRootPointer)

Visual Basic (VB.NET)

InOrder(TreeRootPointer)

Python

InOrder(TreeRootPointer)

Mark points

  • Include the ideas shown in the solution above.

Part 3(e)(iii) — solution

1 mark for screenshot showing data input and output in correct order 1 e.g. University Press & Assessment 2026 Page 46 of 46 Trace ID: PC-BEC0C4D104 Re-uploading, mirroring or re-hosting this file on any other website or domain is unauthorised and traceable. Licensed for hosting on papacambridge.com only. PapaCambridge 9618/43 Mark Scheme June · papacambridge.com 2026 | Source: papacambridge.com 9618/43 Mark Scheme June 2026 Downloaded from PapaCambridge - https://papacambridge.com/

Mark points

  • Include the ideas shown in the solution above.