Question 4

OCR Computer Science June 2017 Paper 2A level14 marks

On the specification

(a)
1.4 Data types, data structures and algorithms
(b)(i)
2.3 Algorithms
(b)(ii)
2.3 Algorithms
(b)(iii)
2.2 Problem solving and programming
Question text

4 A data structure is shown below in Fig. 4.1. A B C D X E F H J G K I N L M Fig. 4.1 (a) Identify the data structure shown in Fig. 4.1. [1] (b) The programmer is considering using a depth-first (post-order) traversal, or a breadth-first traversal to find the path between node A and node X. (i) Explain the difference between a depth-first (post-order) and breadth-first traversal. [4] (ii) Show how a depth-first (post-order) traversal would find the path between node A and node X for the structure shown in Fig. 4.1. [6] (iii) Explain how you used backtracking in your answer to part (b)(ii). [3]