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

Exam Questions

57 mins8 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 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.

Did this page help you?

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.

Did this page help you?

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.

Did this page help you?

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.

Did this page help you?

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.

Did this page help you?

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.

Did this page help you?

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

Did this page help you?

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.

Did this page help you?