Describing Sorting Algorithm Steps

A question is this type if and only if it asks the student to describe in words how to carry out a pass of a sorting algorithm (typically bubble sort).

8 questions · Easy -1.7

Sort by: Default | Easiest first | Hardest first
Edexcel D1 2015 June Q2
10 marks Easy -1.8
2. A list of \(n\) numbers needs to be sorted into descending order starting at the left-hand end of the list.
  1. Describe how to carry out the first pass of a bubble sort on the numbers in the list.
    1. State which number in the list is guaranteed to be in the correct final position after the first pass.
    2. Write down the maximum number of passes required to sort a list of \(n\) numbers.
  2. The numbers below are to be sorted into descending order. Use a bubble sort, starting at the left-hand end of the list, to obtain the sorted list. You need only give the state of the list after each pass. $$\begin{array} { l l l l l l l l l } 11 & 9 & 4 & 13 & 5 & 1 & 7 & 12 & 8 \end{array}$$
  3. Apply the first-fit decreasing bin packing algorithm to your ordered list to pack the numbers into bins of size 21
Edexcel D1 2020 June Q2
13 marks Easy -1.8
2.
    1. Describe how to carry out the first pass of a bubble sort when it is used to sort a list of \(n\) numbers into ascending order.
    2. Write down the circumstances under which a bubble sort stops. A bubble sort, starting at the left-hand end of the list, is used to sort a list of ten numbers into ascending order. After a number of passes the list reads
      0.9
      0.5
      0.7
      1.2
      1.5
      1.4
      1.1
      1.7
      2.2
      3.2
  1. Determine the maximum number of passes that could have taken place on this list. You must give a reason for your answer.
  2. Complete the bubble sort to produce a list of the numbers in ascending order. You only need to give the state of the list after each complete pass.
  3. Use the first-fit decreasing bin packing algorithm to determine how the ten numbers listed above can be packed into bins of size 4
Edexcel D1 2018 June Q2
12 marks Easy -1.2
2. A list of nine numbers needs to be sorted into descending order.
  1. Describe how to carry out the first pass of a bubble sort on the numbers in the list. Mayleen used a sorting algorithm to sort a list of nine numbers into descending order. Mayleen's list after the first pass through the algorithm is given below. $$\begin{array} { l l l l l l l l l } 30 & 33 & 35 & 27 & 20 & 24 & 21 & 15 & 19 \end{array}$$
  2. Explain how you know that Mayleen did not use the bubble sort algorithm. Given that Mayleen used the quick sort algorithm,
  3. write down the number that was used as a pivot for the first pass,
  4. complete the quick sort to obtain a fully sorted list in descending order. You must make your pivots clear.
  5. Use the first-fit decreasing bin packing algorithm to determine how the numbers listed can be packed into bins of size 60 A tenth number, 18, is added to the list of nine numbers.
  6. Determine whether it is possible to pack the ten numbers into 4 bins of size 60 . You must justify your answer.
OCR MEI D1 2013 June Q2
8 marks Easy -1.8
2 The instructions labelled 1 to 7 describe the steps of a sorting algorithm applied to a list of six numbers.
1 Let \(i\) equal 1.
2 Repeat lines 3 to 7, stopping when \(i\) becomes 6 .
OCR MEI D1 2013 June Q3
8 marks Easy -1.8
3 Let \(j\) equal 1.
OCR MEI D1 2013 June Q4
16 marks Easy -1.8
4 Repeat lines 5 and 6 , until \(j\) becomes \(7 - i\).
OCR MEI D1 2013 June Q5
16 marks Easy -1.8
5 If the \(j\) th number in the list is bigger than the \(( j + 1 )\) th, then swap them.
OCR MEI D1 2013 June Q6
16 marks Easy -1.8
6 Let the new value of \(j\) be \(j + 1\).