BREAKING
Student's code works, nobody knows why, including student★Local teen writes pseudocode, accidentally invents a language★Binary joke told in class, exactly 10 students laugh★
  1. Home
  2. A Level
  3. Computer Science
  4. OCR
  5. Dijkstra's and A* shortest path algorithms

OCR A Level Computer Science

Topic questions Algorithms Dijkstra's & A* shortest path algorithms

Dijkstra's & A* shortest path algorithms

7 questions · 156 marks · about 3 hours

Dijkstra's and A* shortest path algorithms questions

OCR H446 Dijkstra's and A* shortest path algorithms 7 questions

Algorithms and programming June 2025, Question 5 11 marks

Also involves Graphs (data structure)

Figure for question 5
(a)

Explain why this graph is a visualisation of the problem.

[2]
Reveal mark scheme Mark scheme for question 5(a)
(b)

A user needs to travel from planet A to planet H. They need to travel the least expensive route.

Show how Dijkstra’s algorithm can be used on the directed graph shown in Fig. 5 to find the shortest path from start planet A to the end planet H.

You must state the nodes on the final path and the distance of this path. Show your working.

You may use the table to give your answer.

Figure for question 5
[7]
Reveal mark scheme Mark scheme for question 5(b)
(c)

The A* algorithm can also be used to find the shortest path in a graph.

Describe how an A* algorithm uses heuristics to be an efficient algorithm.

[2]
Reveal mark scheme Mark scheme for question 5(c)

Algorithms and programming June 2024, Question 3 20 marks

Also involves Trees and binary search trees · Graphs (data structure)

A computer game has a building containing 7 rooms. There are secret passages between each room. Fig. 3 shows the rooms and the passages between the rooms represented as a graph data structure.

Figure for question 3
(a)

The number in bold below each node in Fig. 3 is the heuristic value.

Perform an A* algorithm on the graph shown in Fig. 3 to find the shortest path from A to G.

Show your working, the nodes visited and the distance.

You may use the table below to give your answer.

Figure for question 3
[7]
Reveal mark scheme Mark scheme for question 3(a)
(b)

State four ways that a graph data structure is different from a tree data structure.

[4]
Reveal mark scheme Mark scheme for question 3(b)
(c)

* The final game will involve multiple computer-controlled characters and interactive elements that make use of artificial intelligence to determine the moves they will make.

The artificial intelligence will use heuristics to determine where the computer-controlled characters will move in the game.

Discuss how heuristics can be used in algorithms.

You should include the following in your answer:

• the purpose of heuristics

• the benefits and drawbacks of heuristics

• the suitability of heuristics in algorithms within a computer game.

[9]
Reveal mark scheme Mark scheme for question 3(c)

Algorithms and programming June 2023, Question 1 24 marks

A tree is one example of a data structure.

(a)(i)

Give two characteristics of a tree data structure.

[2]
Reveal mark scheme Mark scheme for question 1(a)(i)
(a)(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]
Reveal mark scheme Mark scheme for question 1(a)(ii)
(a)(iii)

Describe how a leaf node is deleted from a binary search tree.

[2]
Reveal mark scheme Mark scheme for question 1(a)(iii)
(a)(iv)

Describe how a binary search tree can be searched for a value.

[4]
Reveal mark scheme Mark scheme for question 1(a)(iv)
(a)(v)

Identify the order that the nodes will be visited in a depth-first (post-order) traversal of this binary search tree.

Figure for question 1
[4]
Reveal mark scheme Mark scheme for question 1(a)(v)
(a)(vi)

Explain how backtracking is used in depth-first (post-order) traversals.

[2]
Reveal mark scheme Mark scheme for question 1(a)(vi)
(b)
Figure for question 1 Figure for question 1 Figure for question 1
[6]
Reveal mark scheme Mark scheme for question 1(b)

Algorithms and programming June 2022, Question 5 14 marks

Also involves Graphs (data structure)

Figure for question 5
(a)(i)

State one way a directed graph is different to an undirected graph.

[1]
Reveal mark scheme Mark scheme for question 5(a)(i)
(a)(ii)

State one way a graph data structure is different to a tree data structure.

[1]
Reveal mark scheme Mark scheme for question 5(a)(ii)
(b)

Give one reason why the graph is a visualisation of the problem.

[1]
Reveal mark scheme Mark scheme for question 5(b)
(c)(i)
Figure for question 5 Figure for question 5
[6]
Reveal mark scheme Mark scheme for question 5(c)(i)
(c)(ii)

Give a similarity and difference between the performance of Dijkstra’s algorithm and the performance of A* algorithm.

[2]
Reveal mark scheme Mark scheme for question 5(c)(ii)
(d)(i)

State why performance modelling is used to test a system.

[1]
Reveal mark scheme Mark scheme for question 5(d)(i)
(d)(ii)

Describe how performance modelling can be used in the delivery system.

[2]
Reveal mark scheme Mark scheme for question 5(d)(ii)

Algorithms and programming November 2021, Question 1 33 marks

Taylor is creating an online multiplayer game where users can create accounts and build their own circus. Each circus will contain characters such as clowns, animals, magicians and dancers.

Users can set up a new circus in the online world, purchase new characters and visit other users’ circuses.

(a)

Taylor uses computational methods to analyse the problem including abstraction.

Describe how Taylor could use abstraction in the design of his online circus game.

[3]
Reveal mark scheme Mark scheme for question 1(a)
(b)

Taylor will make use of concurrent processing within his circus game.

(b)(i)

Describe what is meant by the term ‘concurrent processing’.

[2]
Reveal mark scheme Mark scheme for question 1(b)(i)
(b)(ii)

Explain why concurrent processing is needed to allow multiple users to log in and interact with game elements at the same time.

[3]
Reveal mark scheme Mark scheme for question 1(b)(ii)
(c)

Some of the characters in the game will move and interact independently. Taylor is going to use graphs to plan the movements that each character can take within the game.

DancerGold is one character. The graph shown in Fig. 1 shows the possible movements that DancerGold can make.

Figure for question 1

DancerGold’s starting state is represented by node A. DancerGold can take any of the paths to reach the end state represented by node G.

The number on each path represents the number of seconds each movement takes.

The number in bold below each node is the heuristic value from A.

(c)(i)

Define the term heuristic in relation to the A* algorithm.

[2]
Reveal mark scheme Mark scheme for question 1(c)(i)
(c)(ii)

Perform an A* algorithm on the graph shown in Fig. 1 to find the shortest path from the starting node to the end node. Show your working, the nodes visited and the distance. You may choose to use the table below to give your answer.

Figure for question 1
[8]
Reveal mark scheme Mark scheme for question 1(c)(ii)
(d)

A breadth-first traversal can be performed on both a tree and a graph.

Show how a breadth-first traversal is performed on the following binary tree.

Figure for question 1
[6]
Reveal mark scheme Mark scheme for question 1(d)
(e)

* The game will have thousands of users. Taylor will store data about the users and their actions while playing the game in a large database.

Evaluate how Taylor can use data mining to inform future changes to improve his circus game.

[9]
Reveal mark scheme Mark scheme for question 1(e)

Algorithms and programming June 2019, Question 4 27 marks

Mabel is a software engineer. She is writing a computer game for a client. In the game the main character has to avoid their enemies. This becomes more difficult as the levels of the game increase.

(a)

Mabel uses decomposition to design the program.

Explain how decomposition can aid the design of this program.

[2]
Reveal mark scheme Mark scheme for question 4(a)
(b)

The computer game allows a user to select a character (e.g. name, gender). They can then choose a level for the game (easy, normal, challenging). The user controls their character by moving it left or right. The character can jump using space bar as an input. If the character touches one of the enemies then it loses a life. The character has to make it to the end of the level without losing all their lives.

The game is designed in a modular way.

(b)(i)

One sub-procedure will handle the user input.

Describe three other sub-procedures Mabel could create for the given game description.

[6]
Reveal mark scheme Mark scheme for question 4(b)(i)
(b)(ii)

Describe the decision that the program will need to make within the user input sub- procedure and the result of this decision.

[2]
Reveal mark scheme Mark scheme for question 4(b)(ii)
(b)(iii)

Define pipelining and give an example of how it could be applied in the program.

[2]
Reveal mark scheme Mark scheme for question 4(b)(iii)
(c)
Figure for question 4
[6]
Reveal mark scheme Mark scheme for question 4(c)
(d)

*Mabel has been told that true programmers write programs in a text editor, and do not use IDEs. Mabel does not agree with this statement.

Discuss the use of an IDE in the development of this program.

[9]
Reveal mark scheme Mark scheme for question 4(d)

Algorithms and programming June 2018, Question 3 27 marks

Also involves Trees and binary search trees · Graphs (data structure)

Figure for question 3
(a)

The graph in Fig. 3 is a visualisation of the problem.

(a)(i)

Identify one difference between a graph and a tree.

Figure for question 3
[1]
Reveal mark scheme Mark scheme for question 3(a)(i)
(a)(ii)

Explain how the graph is an abstraction of the problem.

Figure for question 3
[2]
Reveal mark scheme Mark scheme for question 3(a)(ii)
(a)(iii)

Identify two advantages of using a visualisation such as the one shown in Fig. 3.

Question 3, shown as an image
Question 3, shown as an image
[2]
Reveal mark scheme Mark scheme for question 3(a)(iii)
(b)

Demonstrate how Dijkstra’s algorithm would find the shortest path to the solution in Fig. 3.

Figure for question 3

maths symbol

[7]
Reveal mark scheme Mark scheme for question 3(b)
(c)

* The creator of the puzzle has been told that the A* algorithm is more efficient at finding the shortest path because it uses heuristics.

Compare the performance of Dijkstra’s algorithm and the A* search algorithm, making reference to heuristics, to find the shortest path to the problem.

Figure for question 3

maths symbol

[9]
Reveal mark scheme Mark scheme for question 3(c)
(d)
Figure for question 3 Figure for question 3 Figure for question 3
[6]
Reveal mark scheme Mark scheme for question 3(d)

Report a problem with a question on this page
What is wrong?

Goes to whoever maintains the question split. No account needed and nothing is published on this page.

Memes

Certified Computer Science memes. Peer-reviewed by nobody.

Laugh now. Cry in the exam hall later. Then come back and do a past paper.

Write a proper algorithm
Write ‘sort it’ and leave
Me on the 6-mark pseudocode question
Debugging with print statements
Using a trace table
Knowing the difference between = and ==
Explaining recursion by explaining recursion
Code enlightenment, ranked

Mum 💖

can you fix the wifi since you do computers 🥰

that's not what computer science is

so that's a no then

📱 Screen time this week · Discord8h 2m

Turned it off and on again

Computer Science starter pack

Laptop with 47 tabs openPython error on line 1Counting binary on fingersThis website
Compiled with zero errors