Question 1

OCR Computer Science June 2023 Algorithms and programming (H446-02)A level24 marks

On the specification

(a)(i)
1.4 Data types, data structures and algorithms
(a)(ii)
1.4 Data types, data structures and algorithms2.3 Algorithms
(a)(iii)
2.3 Algorithms
(a)(iv)
2.3 Algorithms
(a)(v)
2.3 Algorithms
(a)(vi)
2.2 Problem solving and programming2.3 Algorithms
(b)
2.3 Algorithms
Question text

1 A tree is one example of a data structure. (a) (i) Give two characteristics of a tree data structure. 1 2 [2] (ii) The following data is entered into a binary search tree. 22 13 5 36 55 14 8 Draw the binary search tree when the given data is entered in the order given. [4] (iii) Describe how a leaf node is deleted from a binary search tree. [2] (iv) Describe how a binary search tree can be searched for a value. [4] (v) Identify the order that the nodes will be visited in a depth-first (post-order) traversal of this binary search tree. H C P A F L T [4] (vi) Explain how backtracking is used in depth-first (post-order) traversals. [2] (b) A graph is another type of data structure. An example graph is shown in Fig. 1. 2 C A G 58 10 4 B D 12 1 2 8 F E Fig. 1 Show how Dijkstra’s algorithm can be used on the graph shown in Fig. 1 to find the shortest path from start node A to end node G. You must state the nodes on the final path and the distance of this path. Show your working. You may use the table below to give your answer. Node Distance travelled Previous node Final path: Distance: [6]