AQA A Level Tree traversal algorithms