Algorithms, flow charts and bin packingEdexcel International A Level Maths: Subtopic test
10 questions, 27 marks
Edexcel International A Level Maths
Algorithms, flow charts and bin packing
Total 27 marks
Name
Class
Date
- 1An algorithm is described as follows.
Step 1: Input a number .
Step 2: Set equal to 0.
Step 3: Add to .
Step 4: Replace by .
Step 5: If , go to Step 3.
Step 6: Print .(a)Find the value printed when the input is .[1 mark]- A
- B
- C
- D
(b)For the input , how many times is Step 3 performed?[1 mark]- A
- B
- C
- D
(c)Find the value printed when the input is .[2 marks]Total for question 1: 4 marks
- 2Eight files of sizes 9, 7, 11, 6, 5, 13, 12 and 10 megabytes (MB) are to be stored on memory sticks. Each memory stick can hold at most 20 MB.(a)Find the lower bound for the number of memory sticks needed.[1 mark]
- A
- B
- C
- D
(b)The files are packed in the order given using the first-fit algorithm. How many memory sticks are used?[1 mark]- A
- B
- C
- D
(c)Use the first-fit decreasing algorithm to pack the files, and write down the contents of each memory stick.[2 marks]Total for question 2: 4 marks
- 3An algorithm is described as follows.
Step 1: Input two positive integers and , with .
Step 2: Let be the remainder when is divided by .
Step 3: If , print and stop.
Step 4: Replace by and by , then go to Step 2.(a)Apply the algorithm to the inputs and , showing the values of , and each time Step 2 is performed.[3 marks](b)(i) State what the algorithm finds.[4 marks]
(ii) Apply the algorithm to and . State the value printed and the number of times Step 2 is performed.Total for question 3: 7 marks
- 4A list of numbers is written in ascending order. The following algorithm is used to search the list for a number .
Step 1: Find the middle item of the list. For a list of items, the middle item is in position if is odd and if is even.
Step 2: If the middle item equals , stop: has been found.
Step 3: If is smaller than the middle item, delete the middle item and every item after it. Otherwise delete the middle item and every item before it.
Step 4: If no items remain, stop: is not in the list. Otherwise go to Step 1.(a)The list is 4, 9, 13, 17, 21, 26, 30, 35, 41, 47.[6 marks]
(i) State the position and value of the middle item of the whole list.
(ii) Apply the algorithm with , showing the middle item chosen each time and the items that remain.
(iii) Apply the algorithm with and state the outcome.(b)(i) Explain why the list must be in ascending order for the algorithm to work.[6 marks]
(ii) The algorithm is applied to a list of 15 items with smaller than every item. State the position of the middle item chosen each time.
(iii) Find the greatest number of times Step 1 is performed for a list of 20 items.Total for question 4: 12 marks
End of questions
Written by the Exaim team, led by Shaun Daswani (Head of Upper Secondary, Improve ME Institute; MSc Financial Mathematics, Imperial College London; BSc, UCL) and Jason Daswani (operational lead, Improve ME Institute; LSE).