Question 1
A program stores entered data in a binary search tree.
The current contents of the tree are shown:
Complete the diagram to show the contents of the tree after the following data is added:
England, Scotland, Wales, Australia
[3]
Show the order of the nodes visited in a breadth first traversal on the following tree.
[3]
A pseudocode algorithm is written to search the tree to determine if the data item “Sweden” is in the tree.
The function currentNode.left()returns the node positioned to the left of currentNode
Complete the algorithm.
[5]
The algorithm needs to be used in different scenarios, with a range of different trees.
Identify two preconditions needed of a tree for this algorithm to work.
[2]