Question 3
AQA Computer Science Specimen Paper 1 (7517/1)A level17 marks
On the specification
- 3.1
- 4.2 Fundamentals of data structures
- 3.2
- 4.2 Fundamentals of data structures
- 3.3
- 4.2 Fundamentals of data structures
- 3.4
- 3.4 Theory of computation3.2 Fundamentals of data structures
- 3.5
- 3.4 Theory of computation
- 3.6
- 4.4 Theory of computation
- 3.7
- 4.4 Theory of computation
Question text
3 The Cat transportation company (CTC) is a business that specialises in preparing cats for cat shows. They need to take five cats to the AQA cat show. They will transport the cats in their van. CTC owns only one van. They cannot put all the cats in their van at the same time because some of the cats get stressed when in the company of some of the other cats. The cats would not therefore arrive in top condition for the cat show if they were all in the van at the same time. The graph in Figure 3 shows the relationships between the five cats (labelled 1 to 5). If there is an edge between two cats in the graph then they cannot travel in the van together at the same time. Figure 3 1 2 5 43 3.1 Explain why the graph in Figure 3 is not a tree. [1 mark] 3.2 Represent the graph shown in Figure 3 as an adjacency list by completing Table 3. Complete Table 3 and copy the table into the Electronic Answer Document. [2 marks] Table 3 Vertex (in Figure 3) Adjacent vertices 1 2 3 4 5 Table 4 shows how the graph in Figure 3 can be represented as an adjacency matrix. Table 4 Vertex (in Figure 3) 1 2 3 4 5 10 1 1 0 0 21 0 1 1 0 31 1 0 0 1 40 1 0 0 0 50 0 1 0 0 3.3 Explain the circumstances in which it is more appropriate to represent a graph using an adjacency list instead of an adjacency matrix. [2 marks] Figure 4 shows an algorithm, written in pseudo-code, that CTC use. Figure 4 NoOfCats 5 Cat[1] 1 FOR A 2 TO NoOfCats B 1 C 1 WHILE B < A DO IF M[A, B] = 1 THEN IF Cat[B] = C THEN B 1 C C + 1 ELSE B B + 1 ENDIF ELSE B B + 1 ENDIF ENDWHILE Cat[A] C ENDFOR The two-dimensional array, M, is used to store the adjacency matrix shown in Table 4. 3.4 Complete Table 5 to show the result of tracing the algorithm in Figure 4. [6 marks] Copy your answer in Table 5 into the Electronic Answer Document. Table 5 Cat NoOfCats A B C 1 2 3 4 5 3.5 Explain the purpose of the algorithm in Figure 4. [1 mark] After a cat show, CTC needs to return the cats to their owners. They can have all the cats in the van at the same time because the show is now finished. CTC likes to plan the return journey so that the shortest possible distance is travelled by the van. This is an example of an intractable problem. 3.6 What is meant by an intractable problem? [2 marks] 3.7 What approach might a programmer take if asked to solve an intractable problem? [2 marks]