Use a bubble sort, starting at the left-hand end of the list, to sort these numbers into ascending order.
34 18 52 27 41 9 30
You should show the state of the list after each pass.
Trace tables for a flow chart or written algorithm, bubble sort and quick sort with each pass shown, the order of an algorithm and estimating run times, the Euclidean algorithm.
12 original questions, 66 marks. Type your answers below for an instant mark and a score (algebra in any equivalent form, e.g. 2sqrt(3) or 2√3), or print the worksheet, mark it with the answers sheet, and use the solutions to see every step written out by hand.
Use a bubble sort, starting at the left-hand end of the list, to sort these numbers into ascending order.
34 18 52 27 41 9 30
You should show the state of the list after each pass.
A bubble sort is an algorithm of quadratic order. A laptop takes 0.8 seconds to bubble sort a list of 400 names.
A different algorithm has cubic order. It takes 1.2 seconds when the input has size 50.
Use the Euclidean algorithm to find the highest common factor of 4199 and 1547. Show each step of your working.
Use a quick sort to sort the list below into ascending order. You should show the result of each pass and identify your pivots clearly.
47 12 85 33 60 21 74 9 56 38
The names of nine members of a chess club are listed below.
Priya Callum Zara Mohammed Erin Tomasz Hannah Kofi Beth
Use a quick sort to put the names into alphabetical order. You should show the result of each pass and identify your pivots clearly.
The flow chart describes an algorithm.
The list below is to be sorted into descending order using a bubble sort, starting at the left-hand end of the list.
15 42 8 27 33 19
On average a quick sort has order n log n. A computer takes 0.36 seconds to quick sort a list of 1000 numbers.
An algorithm of cubic order takes 0.05 seconds for an input of size 20.
An algorithm is shown below. INT(x) means the integer part of x.
Step 1 Input a positive integer N
Step 2 Let P = 1 and B = 0
Step 3 Let R be the remainder when N is divided by 2
Step 4 Let B = B + R × P
Step 5 Let N = INT(N ÷ 2)
Step 6 Let P = 10P
Step 7 If N > 0 go to Step 3
Step 8 Output B
Step 9 Stop
The six distinct integers 24, x, 17, 31, 12, 28 are to be sorted into ascending order using a bubble sort, starting at the left-hand end of the list.
After the first pass the list is 24 17 x 12 28 31
After the second pass the list is 17 24 12 28 x 31
The list below is to be sorted into descending order.
63 18 45 92 27 71 54 36
An algorithm is shown below.
Step 1 Input a positive integer n
Step 2 Let i = 1 and T = 0
Step 3 Let j = i
Step 4 Let T = T + j
Step 5 Let j = j + 1
Step 6 If j ≤ n go to Step 4
Step 7 Let i = i + 1
Step 8 If i ≤ n go to Step 3
Step 9 Output T
Step 10 Stop
Answer the questions above and your score appears here.
Every question here is original and written by Robinson Tuition. It follows the Edexcel AS Further Mathematics specification and suits AQA and OCR Further Maths too; this is not an exam-board paper.