Algorithms (Edexcel A Level Further Maths: Decision 1): Exam Questions

Exam code: 9FM0

2 hours13 questions
1a
Sme Calculator
4 marks

The following algorithm produces a numerical approximation for the integral

I space equals space integral subscript straight A superscript straight B space x to the power of 4 space straight d x

Step 1

Start

Step 2

Input the values of A, B and N

Step 3

Let H = (B – A) / N

Step 4

Let C = H / 2

Step 5

Let D = 0

Step 6

Let D = D + A4+ B4

Step 7

Let E = A

Step 8

Let E = E + H

Step 9

If E = B go to Step 12

Step 10

Let D = D + 2 × E4

Step 11

Go to Step 8

Step 12

Let F = C × D

Step 13

Output F

Step 14

Stop

For the case when A = 1, B = 3 and N = 4,

(i) complete the table in the answer book (opens in a new tab) to show the results obtained at each step of the algorithm. 

(ii) State the final output. 

1b
Sme Calculator
3 marks

Calculate, to 3 significant figures, the percentage error between the exact value of I and the value obtained from using the approximation to I in this case.

2a
Sme Calculator
2 marks

2.1

1.7

3.0

1.9

3.2

1.2

3.3

1.4

1.5

0.2

Use the first-fit bin packing algorithm to determine how the numbers listed above can be packed into bins of size 5

2b
Sme Calculator
4 marks

The list of numbers is now to be sorted into descending order.

Perform a quick sort on the original list to obtain the sorted list. You should show the result of each pass and identify your pivots clearly.

2c
Sme Calculator
2 marks

For a list of n numbers, the quick sort algorithm has, on average, order n space log space n.

Given that it takes 2.32 seconds to run the algorithm when n = 450

Calculate approximately how long it will take, to the nearest tenth of a second, to run the algorithm when n = 11 250. You should make your method and working clear.

3a
Sme Calculator
3 marks

3.7

2.5

5.4

1.9

2.7

3.2

3.1

2.7

4.2

2.0

Use the first‐fit bin packing algorithm to determine how the numbers listed above can be packed into bins of size 8.5

3b
Sme Calculator
3 marks

The first‐fit bin packing algorithm is to be used to pack n numbers into bins. The number of comparisons is used to measure the order of the first‐fit bin packing algorithm.

By considering the worst case, determine the order of the first‐fit bin packing algorithm in terms of n. You must make your method and working clear.

4a
Sme Calculator
3 marks

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

Explain why 13 space less than space x space less than space 21

4b
Sme Calculator
2 marks

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

Using this information, write down the smallest interval that must contain x, giving your answer as an inequality.

4c
Sme Calculator
2 marks

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,

calculate the value of x. You must give reasons for your answer.

5a
Sme Calculator
3 marks

3.5 space space space space space space space 6.3 space space space space space space space space 2.9 space space space space space space space space 5.4 space space space space space space space space 3.1 space space space space space space space space 2.8 space space space space space space space space 3.7 space space space space space space space space 1.7 space space space space space space space space 4.1 space space space space space space space space 3.3 space space space space space space space space 2.2

The numbers listed above are to be sorted into descending order.

(i) Perform one pass of a bubble sort, starting at the left-hand end of the list. You must write down the list that results at the end of this first pass.

(ii) Write down the number of comparisons and the number of swaps performed during this first pass.

5b
Sme Calculator
3 marks

After a second pass using this bubble sort, the updated list is

6.3 space space space space space space space space 5.4 space space space space space space space space space 3.5 space space space space space space space space space 3.1 space space space space space space space space space 3.7 space space space space space space space space space 2.9 space space space space space space space space space 4.1 space space space space space space space space space 3.3 space space space space space space space space space 2.8 space space space space space space space space space 2.2 space space space space space space space space space 1.7

Use a quick sort on this updated list to obtain the fully sorted list. You should show the result of each pass and identify your pivots clearly.

5c
Sme Calculator
3 marks

Apply the first-fit decreasing bin packing algorithm to the fully sorted list to pack the numbers into bins of size 11.5

5d
Sme Calculator
2 marks

Determine whether your answer to part (c) uses the minimum number of bins. You must justify your answer.

6a
Sme Calculator
1 mark
fig-1-november-2021-9fm0-3d

Figure 1

A Hamiltonian cycle for the graph in Figure 1 begins C, V, E, X, A, W, ….

Complete the Hamiltonian cycle.

6b
Sme Calculator
3 marks

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.

7a
Sme Calculator
4 marks

30 space space space space space space space space space space space 12 space space space space space space space space space space space 5 space space space space space space space space space space space 2 space space space space space space space space space space space 23 space space space space space space space space space space space 18 space space space space space space space space space space space 36 space space space space space space space space space space space 10 space space space space space space space space space space space 15 space space space space space space space space space space space 24

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.

7b
Sme Calculator
3 marks

The ten numbers are to be packed into bins of size n, where  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

Explain why the value of the integer n must be either 44 or 45

7c
Sme Calculator
3 marks

Use the first-fit decreasing bin packing algorithm to determine how the numbers can be packed into bins of size 45

8a
Sme Calculator
2 marks

A list of n numbers needs to be sorted into descending order starting at the left-hand end of the list.

Describe how to carry out the first pass of a bubble sort on the numbers in the list.

8b
Sme Calculator
2 marks

Bubble sort is a quadratic order algorithm.

A computer takes approximately 0.021 seconds to apply a bubble sort to a list of 2000 numbers.

Estimate the time it would take the computer to apply a bubble sort to a list of 50 000 numbers. Make your method clear.

9a
Sme Calculator
2 marks

A gardener needs the following lengths of string. All lengths are in metres.

4.3    6.1    5.1    4.7    2.5    5.9    3.4    1.7    2.1    0.4    1.3

She cuts the lengths from balls of string. Each ball contains 10m of string.

Calculate a lower bound for the number of balls of string the gardener needs. You must make your method clear.

9b
Sme Calculator
3 marks

Use the first‑fit bin packing algorithm to determine how the lengths could be cut from the balls of string.

10a
Sme Calculator
3 marks

The following algorithm determines the number of comparisons made when Prim's algorithm is applied to K subscript n

Step 1 Start

Step 2 Input the value of n

Step 3 Let a space equals space 1

Step 4 Let b space equals space n space minus space 2

Step 5 Let c space equals space b

Step 6 Let a space equals space a space plus space 1

Step 7 Let space b space equals space b space minus space 1

Step 8 Let c space equals space c space plus space left parenthesis a space cross times space b right parenthesis space plus space left parenthesis a space minus space 1 right parenthesis

Step 9 If space b space greater than space 0 go to Step 6

Step 10 Output space c

Step 11 Stop

For straight K subscript 5, complete the table below to show the results obtained at each step of the algorithm.

Table with 12 rows and 4 columns labelled "n", "a", "b", "c". Note above: usage of all rows or boxes may not be required.
The image shows the word "Output" in grey text at the top left, followed by a thin horizontal line extending across a white background.
10b
5 marks
Pentagon ABCDE with diagonals AC, BD, BE, and CD. Edge weights: AB 17, BC 19, CD 13, DE 20, EA 24, AC 23, BE 28, BD 21, CE 14. Labelled Figure 4.

The weights of the ten arcs in Figure 4 are

17    21    24    14    23    13    15    19    28    20

(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.

10c
1 mark

Find the maximum total number of comparisons required to sort the weights of the 10 arcs of straight K subscript 5 into ascending order using bubble sort.

10d
Sme Calculator
3 marks

It is given that the maximum total number of comparisons required to sort the weights of the arcs of straight K subscript n into ascending order using bubble sort is

lambda n left parenthesis n minus 1 right parenthesis left parenthesis n plus 1 right parenthesis left parenthesis n minus 2 right parenthesis

where lambda is a constant.

Determine the maximum total number of comparisons required to sort the weights of the arcs of space straight K subscript 50 into ascending order using bubble sort. You must make your method and working clear.

11a
Sme Calculator
6 marks
Diagram of connected nodes labelled A to J, forming a network with edges labelled by numbers, depicting a geometric shape with various intersecting lines.

Figure 4 represents a network with nodes, A, B, C, D, E, F, G, H and J. The number on each edge gives the length of the corresponding edge.

(i) Use Dijkstra’s algorithm to find the shortest path from A to J.

(ii) State the length of the shortest path from A to J.

Graph with vertices A to J connected by weighted edges. Key shows vertex, order of labelling, and final value. Space for shortest path from A to J.
11b
Sme Calculator
2 marks

One application of Dijkstra’s algorithm has order space n squared , where space n is the number of nodes in the network.

It takes a computer 0.0312 seconds to find the shortest path from a given start node to a given end node in a network of 9 nodes.

Calculate approximately how long it would take, in minutes, for the computer to find the shortest path from a given start node to a given end node for a network of 9000 nodes.

12a
Sme Calculator
1 mark

The eleven distinct numbers listed below are to be packed into bins of size 40

15

22

3

9

23

x

5

4

18

20

13

It is known that x

  • is an integer less than 40

  • is the largest number in the list

Explain why it is not possible to pack the numbers into 3 bins of size 40

12b
Sme Calculator
2 marks

Given that it is possible to pack the numbers into 4 bins of size 40

determine the range of values for x

12c
3 marks

Use the first-fit bin packing algorithm to determine how the numbers can be packed into bins of size 40

12d
4 marks

Carry out a quick sort to produce a list of the numbers in descending order. You should show the result of each pass and identify your pivots clearly.

12e
2 marks

When the first-fit decreasing bin packing algorithm is applied to the list, neither the 15 nor the 13 is placed in the first bin.

Determine the value of x. You must give reasons for your answer.

13a
Sme Calculator
1 mark

17

8

16

12

24

19

23

11

20

13

4

The eleven numbers listed above 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 eleven numbers, the bins are packed as shown below.

Bin 1: 17 8 12

Bin 2: 16 24

Bin 3: 19 11 4

Bin 4: 23 13

Bin 5: 20

Explain why this packing means that the value of n must be 40

13b
4 marks

The original list of eleven numbers is to be sorted into descending order.

Use a quick sort to obtain the fully sorted list. You must make your pivots clear.

13c
Sme Calculator
2 marks

Apply the first-fit decreasing bin packing algorithm to the fully sorted list to pack the numbers into bins of size 40