Decision 1: Algorithms, graphs, shortest paths, route inspection and TSP – Edexcel A Level Further Mathematics (9FM0)
53 questions · page 3 of 4
Question text
6. The following algorithm determines the number of comparisons made when Prim’s
algorithm is applied to K n
Step 1
Start
Step 2
Input the value of n
Step 3
Let a = 1
Step 4
Let b = n – 2
Step 5
Let c = b
Step 6
Let a = a + 1
Step 7
Let b = b – 1
Step 8
Let c = c + (a × b) + (a – 1)
Step 9
If b > 0 go to Step 6
Step 10
Output c
Step 11
Stop
(a) For K 5 , complete the table in the answer book to show the results obtained at each
step of the algorithm.
(3)
B
19
17
21
15
28
C
A
23
14
24
20
13
E
D
Figure 4
The weights of the ten arcs in Figure 4 are
17
21
24
14
23
13
15
19
28
20
(b) (i) Starting at the left‑hand end of the above list, sort the list into ascending order
using bubble sort. You need only write down the state of the list at the end of
each pass.
(ii) Find the total number of comparisons performed during the sort.
(5)
(c) Find the maximum total number of comparisons required to sort the weights of the
10 arcs of K 5 into ascending order using bubble sort.
(1)
It is given that the maximum total number of comparisons required to sort the weights
of the arcs of K n into ascending order using bubble sort is
λn(n – 1)(n + 1)(n – 2)
where λ is a constant.
(d) Determine the maximum total number of comparisons required to sort the weights
of the arcs of K 50 into ascending order using bubble sort. You must make your
method and working clear.
(3)
(Total for Question 6 is 12 marks)
Question text
3.
(a)
A
B
8
17
4
D
C
12
18
13
E
12
F
Diagram 1
(b)
There are spare copies of these tables, if required, on Page 9.
3rd iteration
A
B
C
D
E
F
A
–
B
–
C
–
D
–
E
–
F
–
4th iteration
A
B
C
D
E
F
A
–
B
–
C
–
D
–
E
–
F
–
Question 3 continued
Question 3 continued
Question 3 continued
(b)
Spare copy for 3rd iteration
A
B
C
D
E
F
A
–
B
–
C
–
D
–
E
–
F
–
Spare copy for 4th iteration
A
B
C
D
E
F
A
–
B
–
C
–
D
–
E
–
F
–
(Total for Question 3 is 10 marks)
Question text
6.
You may not need to use all the rows in this table.
It may not be necessary to complete all the boxes in each row.
n
a
b
c
Output:
Question 6 continued
17
21
24
14
23
13
15
19
28
20
Question 6 continued
Question 6 continued
(Total for Question 6 is 12 marks)
Question text
3. The table below shows the transport options, usual travel times, possible delay times
and corresponding probabilities of delay for a journey. All times are in minutes.
Transport option
Usual travel time
Possible delay time
Probability of delay
10
0.10
Car
52
25
0.02
15
0.05
Train
45
25
0.03
5
0.05
Coach
55
15
0.01
(a) Draw a decision tree to model the transport options and the possible outcomes.
(5)
(b) State the minimum expected travel time and the corresponding transport option
indicated by the decision tree.
(2)
(Total for Question 3 is 7 marks)
Question text
1.
A
U
B
V
C
W
D
X
E
Y
Figure 1
A Hamiltonian cycle for the graph in Figure 1 begins C, V, E, X, A, W, ….
(a) Complete the Hamiltonian cycle.
(1)
(b) Hence use the planarity algorithm to determine whether the graph shown in Figure 1
is planar. You must make your working clear and justify your answer.
(3)
(Total for Question 1 is 4 marks)
Question text
3.
A
B
C
D
E
F
G
H
A
–
24
42
48
34
37
32
22
B
24
–
40
35
30
41
39
44
C
42
40
–
21
26
45
38
36
D
48
35
21
–
32
37
29
27
E
34
30
26
32
–
34
40
28
F
37
41
45
37
34
–
43
41
G
32
39
38
29
40
43
–
38
H
22
44
36
27
28
41
38
–
Table 1
Table 1 shows the shortest distances, in miles, between eight towns, A, B, C, D, E, F, G and H.
(a) Use Prim’s algorithm, starting at A, to find the minimum spanning tree for this table of
distances. You must clearly state the order in which you select the edges of your tree.
(3)
(b) State the weight of the minimum spanning tree.
(1)
A
B
C
D
E
F
G
H
J
31
27
50
29
43
25
49
35
Table 2
Table 2 shows the distances, in miles, between town J and towns A, B, C, D, E, F, G and H.
Pranav needs to visit all of the towns, starting and finishing at J, and wishes to minimise
the total distance he travels.
(c) Starting at J, use the nearest neighbour algorithm to obtain an upper bound for the
length of Pranav’s route. You must state your route and its length.
(2)
(d) Starting by deleting J, and all of its edges, find a lower bound for the length of
Pranav’s route.
(2)
(Total for Question 3 is 8 marks)
Question text
4.
A
57
B
95
72
150
230
63
125
C
F
132
289
191
160
E
84
D
Figure 3
[The total weight of the network is 1648]
Direct roads between six cities, A, B, C, D, E and F, are represented in Figure 3. The weight
on each arc is the time, in minutes, required to travel along the corresponding road.
Floyd’s algorithm is to be used to find the complete network of shortest times between the six cities.
An initial route matrix is given in the answer book.
(a) Set up the initial time matrix.
(1)
(b) Perform the first iteration of Floyd’s algorithm. You should show the time and route
matrices after this iteration.
(2)
The final time matrix after completion of Floyd’s algorithm is shown below.
A
B
C
D
E
F
A
–
57
95
147
63
220
B
57
–
72
204
120
197
C
95
72
–
242
158
125
D
147
204
242
–
84
275
E
63
120
158
84
–
191
F
220
197
125
275
191
–
A route is needed that minimises the total time taken to traverse each road at least once.
The route must start at B and finish at E.
(c) Use an appropriate algorithm to find the roads that will need to be traversed twice.
You should make your method and working clear.
(4)
(d) Write down the length of the route.
(1)
(Total for Question 4 is 8 marks)
Question text
5.
30 12 5 2 23 18 36 10 15 24
(a) The list of ten numbers above is to be sorted into descending order. Use a quick sort
to obtain the sorted list. You should show the result of each pass and identify your
pivots clearly.
(4)
The ten numbers are to be packed into bins of size n, where n is a positive integer.
When the first-fit bin packing algorithm is applied to the original list of ten numbers, the
following allocation is obtained.
Bin 1: 30 12 2
Bin 2: 5 23 10
Bin 3: 18 15
Bin 4: 36
Bin 5: 24
(b) Explain why the value of the integer n must be either 44 or 45
(3)
(c) Use the first-fit decreasing bin packing algorithm to determine how the numbers can
be packed into bins of size 45
(3)
(Total for Question 5 is 10 marks)
Question text
6.
B
15
E
33
17
32
30
D
75
95
F
A
50
50
25
16
41
70
G
105
10
C
113
H
Figure 4
In Figure 4 the weights on the arcs represent distances.
(a) (i) Use Dijkstra’s algorithm to find the shortest path from A to H.
(ii) State the length of the shortest path from A to H.
(6)
One application of Dijkstra’s algorithm has order n 2 , where n is the number of nodes in
the network. A computer produces a table of shortest distances between any two different
nodes by repeatedly applying Dijkstra’s algorithm from each node of the network.
It takes the computer 0.082 seconds to produce a table of shortest distances for a network
of 10 nodes.
(b) Calculate approximately how long it will take, in seconds, for the computer to
produce a table of shortest distances for a network with 200 nodes. You must give a
reason for your answer.
(3)
(c) Explain why your answer to part (b) can only be an approximation.
(1)
(Total for Question 6 is 10 marks)
Question text
4. (a)
Initial time matrix
Initial route matrix
A
B
C
D
E
F
A
B
C
D
E
F
A
A
B
C
D
E
F
A
B
A
B
C
D
E
F
B
C
A
B
C
D
E
F
C
D
A
B
C
D
E
F
D
E
A
B
C
D
E
F
E
F
A
B
C
D
E
F
F
(b) 1st iteration
Time matrix
Route matrix
A
B
C
D
E
F
A
B
C
D
E
F
A
A
B
B
C
C
D
D
E
E
F
F
Question 4 continued
(Total for Question 4 is 8 marks)
Question text
6.
D
49
53
50
51
E
52
H
A
46
52
53
47
51
51
48
B
S
T
52
48
F
I
50
50
46
50
50
53
49
C
G
J
51
47
Figure 3
The staged, directed network in Figure 3 represents a series of roads connecting 12
towns, S, A, B, C, D, E, F, G, H, I, J and T. The number on each arc shows the distance
between these towns, in miles.
Bradley is planning a four‑day cycle ride from S to T.
He plans to leave his home at S. On the first night he will stay at A, B or C, on the
second night he will stay at D, E, F or G, on the third night he will stay at H, I or J, and
he will arrive at his friend’s house at T on the fourth day.
Bradley decides that the maximum distance he will cycle on any one day should be as
small as possible.
(a) Write down the type of dynamic programming problem that Bradley needs to solve.
(1)
(b) Use dynamic programming to complete the table in the answer book.
(9)
(c) Hence write down the possible routes that Bradley could take.
(2)
(Total for Question 6 is 12 marks)
Question text
7. The points P(9p 2 , 18p) and Q(9q 2 , 18q) , p ≠ q , lie on the parabola C with equation
y 2 = 36x
The line l passes through the points P and Q
(a) Show that an equation for the line l is
( p + q) y = 2(x + 9pq)
(3)
The normal to C at P and the normal to C at Q meet at the point A.
(b) Show that the coordinates of A are
( 9( p 2 + q 2 + pq + 2) , −9pq( p + q) )
(7)
Given that the points P and Q vary such that l always passes through the point (12, 0)
(c) find, in the form y 2 = f ( x ) , an equation for the locus of A, giving f ( x ) in simplest
form.
(4)
Question 7 continued
Question 7 continued
Question 7 continued
(Total for Question 7 is 14 marks)
Question text
1. The table below shows the lengths, in km, of the roads in a network connecting seven towns,
A, B, C, D, E, F and G.
A
B
C
D
E
F
G
A
–
24
–
22
35
–
–
B
24
–
25
27
–
–
–
C
–
25
–
33
31
36
26
D
22
27
33
–
–
42
–
E
35
–
31
–
–
37
29
F
–
–
36
42
37
–
40
G
–
–
26
–
29
40
–
(a) By adding the arcs from vertex D along with their weights, complete the drawing of
the network on Diagram 1 in the answer book.
(2)
(b) Use Kruskal’s algorithm to find a minimum spanning tree for the network. You
should list the arcs in the order that you consider them. In each case, state whether
you are adding the arc to your minimum spanning tree.
(3)
(c) State the weight of the minimum spanning tree.
(1)
(Total for Question 1 is 6 marks)
Question text
3.
A
8
B
4
3
C
7
10
6
1
1
D
E
Figure 2
Direct roads between five villages, A, B, C, D and E, are shown in Figure 2. The weight
on each arc is the time, in minutes, it takes to travel along the corresponding road. The
road from D to C is one-way as indicated by the arrow on the corresponding arc.
Floyd’s algorithm is to be used to find the complete network of shortest times between
the five villages.
(a) Set up initial time and route matrices.
(2)
The matrices after two iterations of Floyd’s algorithm are shown below.
Time matrix
Route matrix
A
B
C
D
E
A
B
C
D
E
A
A
–
8
4
7
18
A
B
C
D
B
B
B
8
–
3
15
10
A
B
C
A
E
C
C
4
3
–
11
6
A
B
C
A
E
D
D
7
15
1
–
1
A
A
C
D
E
E
– E
18
10
6
1
B
B
C
D
E
(b) Perform the next two iterations of Floyd’s algorithm that follow from the tables
above. You should show the time and route matrices after each iteration.
(4)
The final time matrix after completion of Floyd’s algorithm is shown below.
Final time matrix
A
B
C
D
E
A
–
7
4
7
8
B
7
–
3
10
9
C
4
3
–
7
6
D
5
4
1
–
1
E
6
5
2
1
–
(c) (i) Use the nearest neighbour algorithm, starting at A, to find a Hamiltonian cycle in
the complete network of shortest times.
(ii) Find the time taken for this cycle.
(iii) Interpret the cycle in terms of the actual villages visited.
(3)
(Total for Question 3 is 9 marks)
Question text
5. The nine distinct numbers in the following list are to be packed into bins of size 50
23 17 19 x 24 8 18 10 21
When the first-fit bin packing algorithm is applied to the numbers in the list it results in
the following allocation.
Bin 1: 23 17 8
Bin 2: 19 x 10
Bin 3: 24 18
Bin 4: 21
(a) Explain why 13 < x < 21
(3)
The same list of numbers is to be sorted into descending order. A bubble sort, starting at
the left-hand end of the list, is to be used to obtain the sorted list. After the first complete
pass the list is
23 19 17 24 x 18 10 21 8
(b) Using this information, write down the smallest interval that must contain x, giving
your answer as an inequality.
(2)
When the first-fit decreasing bin packing algorithm is applied to the nine distinct
numbers it results in the following allocation.
Bin 1: 24 23
Bin 2: 21 19 10
Bin 3: 18 17 x
Bin 4: 8
Given that only one of the bins is full and that x is an integer,
(c) calculate the value of x. You must give reasons for your answer.
(2)
(Total for Question 5 is 7 marks)