Menu

Sorting Algorithms Exam Questions

14 Edexcel GCSE Computer Science (1CP2) exam-style questions on Sorting Algorithms (1.2 Algorithms), 33 marks in all. Answer them on paper or print them, then open the mark schemes and example answers to see how each is marked.

Revise Sorting Algorithms first

Build a paper on 1.2 Algorithms
Print
Download
1Multiple choice1 mark

A list of numbers needs to be sorted into ascending order.

Identify the sorting algorithm that compares each item with the item next to it and swaps them if they are in the wrong order.

[1 mark]
  • ABinary search
  • BBubble sort
  • CLinear search
  • DMerge sort
Mark scheme
  • B Bubble sort (1)
  • The only correct answer is B. The correct answer is bubble sort.
  • A is not correct because a binary search is a search algorithm that halves a sorted list
  • C is not correct because a linear search checks each item in turn
  • D is not correct because a merge sort splits the list into sub-lists and merges them back together
Example answers and how they were marked
Full marks1/1

B Bubble sort

Why: Correct option (1): a bubble sort compares each item with the one next to it and swaps them.

No marks0/1

D Merge sort

Why: Near miss: merge sort also sorts, but it splits the list into sub-lists and merges them, so it does not compare each item with the item next to it.

No marks0/1

A Binary search

Why: Confuses a search algorithm with a sort algorithm: a binary search halves a sorted list to find an item.

2Multiple choice1 mark

A programmer is sorting a large list of customer records.

Identify the sorting algorithm that uses more memory because it creates additional sub-lists.

[1 mark]
  • ABubble sort
  • BBinary search
  • CLinear search
  • DMerge sort
Mark scheme
  • D Merge sort (1)
  • The only correct answer is D. The correct answer is merge sort.
  • A is not correct because a bubble sort sorts in place, swapping items in the original list
  • B is not correct because a binary search is a search algorithm that halves a sorted list
  • C is not correct because a linear search checks each item in turn
Example answers and how they were marked
Full marks1/1

D Merge sort

Why: Correct option (1): a merge sort creates new sub-lists at each split, so uses more memory.

No marks0/1

A Bubble sort

Why: Near miss: bubble sort is a sort algorithm, but it sorts in place and so has a constant, low memory requirement.

No marks0/1

B Binary search

Why: Confuses a search algorithm with a sort algorithm: a binary search halves a sorted list to find an item.

3Multiple choice1 mark

A programmer must choose a sorting algorithm for a large list.

Identify the reason a merge sort is usually more efficient than a bubble sort for a large list.

[1 mark]
  • AIt makes fewer comparisons
  • BIt only needs one pass through the list
  • CIt keeps the largest item in place on each pass
  • DIt uses less memory
Mark scheme
  • A It makes fewer comparisons (1)
  • The only correct answer is A. The correct answer is fewer comparisons.
  • B is not correct because a merge sort still makes several passes as it splits and merges the list
  • C is not correct because it is a bubble sort that moves the largest item into place on each pass
  • D is not correct because a merge sort uses more memory as it creates additional sub-lists
Example answers and how they were marked
Full marks1/1

A It makes fewer comparisons

Why: Correct option (1): efficiency is measured by the number of comparisons, and a merge sort makes fewer than a bubble sort on a large list.

No marks0/1

B It only needs one pass through the list

Why: Near miss: one pass is the best case for a bubble sort on a list that is already in order, not a property of a merge sort.

No marks0/1

D It uses less memory

Why: Common misconception: a merge sort uses more memory, because it creates additional sub-lists.

4Short recall2 marks

A bubble sort is used to sort a list of usernames into alphabetical order.

State two things that happen during one pass of a bubble sort.

[2 marks]
Mark scheme

Award one mark for any of the following up to a maximum of two marks:

  • Each item is compared with the next/adjacent item (1)
  • Items are swapped if they are in the wrong order (1)
  • The item that is last in alphabetical order moves to the end of the list (1)
  • An item can be swapped more than once during the pass (1)

Do not accept "the items are compared" without saying what they are compared with (the next/adjacent item), or "the list is sorted"/"items are put in order" with no reference to comparing or swapping.

Example answers and how they were marked
Full marks2/2

Each item is compared with the item next to it. They are swapped if they are in the wrong order.

Why: Comparison with the next item (1) and swapping if out of order (1).

Some marks1/2

Each item is compared with the item next to it.

Why: Only the comparison point is given (1); no second creditworthy point.

No marks0/2

The list is sorted into alphabetical order.

Why: States the overall outcome of the sort with no reference to comparing or swapping, so it is not credited.

5Short recall2 marks

Merge sort is a divide and conquer algorithm.

State the two main stages of a merge sort.

[2 marks]
Mark scheme

Award one mark for any of the following up to a maximum of two marks:

  • Divide/split the list into two halves/sub-lists (1)
  • Continue dividing the sub-lists until each has one item (1)
  • Merge/combine the sub-lists back into a single list (1)
  • Merge the sub-lists in order / compare items when merging (1)

Do not accept "divide and conquer" on its own (repeats the stem).

Example answers and how they were marked
Full marks2/2

Split the list into halves until each list has one item, then merge the lists back together in order.

Why: Divide/split stage (1) and merge stage in order (1).

Some marks1/2

Divide the list into smaller lists.

Why: Gives only the divide stage (1); no merge stage.

No marks0/2

Compare each item with the next one and swap them.

Why: Describes a bubble sort, not the stages of a merge sort.

6Short recall2 marks

The efficiency of sorting algorithms such as bubble sort and merge sort can be measured.

State two ways the efficiency of a sorting algorithm can be measured.

[2 marks]
Mark scheme

Award one mark for any of the following up to a maximum of two marks:

  • The number of comparisons made (1)
  • The number of passes through the list/loop (1)
  • The amount of memory used (1)

Allow the number of swaps made as an alternative to the number of comparisons, but do not award both.

Do not accept vague answers such as "how fast it is" / "it is quick" without a named measure.

Example answers and how they were marked
Full marks2/2

The number of comparisons it makes and the amount of memory it uses.

Why: Number of comparisons (1) and amount of memory used (1).

Some marks1/2

How many comparisons it makes.

Why: Only one named measure given (1); no second measure.

No marks0/2

It sorts the list quickly.

Why: Vague statement with no named measure; not creditworthy.

7Describe2 marks

A bubble sort is used to sort a list of exam marks into ascending order.

Describe how the bubble sort puts the list into ascending order.

[2 marks]
Mark scheme

Award up to two marks for a linked description such as:

  • Each item is compared with the item next to it (1) so that they are swapped if they are in the wrong order (1)
  • Items in the wrong order are swapped (1) so the largest item moves to the end of the list after one pass (1)
  • Passes through the list are repeated (1) so that the sort stops when a pass makes no swaps (1)
  • After each pass the last items are already in place (1) so fewer comparisons are made in the next pass (1)

Do not accept answers that only say the list is put in order or that repeat the question.

Do not accept descriptions of a merge sort, such as splitting the list in half and merging sub-lists.

Example answers and how they were marked
Full marks2/2

Each item is compared with the item next to it so that they are swapped if they are in the wrong order. The passes through the list are repeated until a pass makes no swaps.

Why: Comparison point (1) with the swap as its linked development (1).

Some marks1/2

It compares each item with the item next to it.

Why: Comparison point (1) but no linked development of what happens as a result (0).

No marks0/2

It splits the list in half until there is one item in each sub-list and then merges them back together.

Why: Describes a merge sort, which the mark scheme says is not accepted, so no mark.

8Describe2 marks

A merge sort is used to sort a list of prices into ascending order.

Describe how the merge sort puts the list into ascending order.

[2 marks]
Mark scheme

Award up to two marks for a linked description such as:

  • The list is split/divided into sub-lists (1) again and again until each sub-list holds a single item (1)
  • Pairs of sub-lists are merged back together (1) by comparing the first item in each list and writing the smaller one to the new list (1)
  • Merging the new sub-lists is repeated (1) until there is a single fully sorted list (1)

Award one mark for the divide stage and one mark for the merge stage, so the maximum for describing only the divide, or only the merge, is one mark.

Allow 'split into single items' on its own as the divide stage (1).

Do not award the merge mark for saying the sub-lists are merged back together unless the answer says how the items are put in order, e.g. by comparing items / writing the smaller one first.

Do not accept 'divide and conquer' on its own, with no description of the dividing or the merging.

Do not accept descriptions of a bubble sort, such as comparing and swapping items next to each other and then repeating the passes.

Example answers and how they were marked
Full marks2/2

The list is split in half again and again until every sub-list has one item in it. The sub-lists are then merged in pairs by comparing the first item of each list and writing the smaller one next, until one sorted list is left.

Why: Divide stage (1) and merge stage with comparisons to put items in order (1).

Some marks1/2

Once the list has been split into single items, the sub-lists are merged back together into one list.

Why: Divide stage (1); the merge mark is not awarded because the answer does not say how the items are put in order, e.g. by comparing them.

No marks0/2

It compares each item with the item next to it and swaps them if they are the wrong way round, then repeats the passes.

Why: Describes a bubble sort, which the mark scheme says is not accepted, so no mark.

9Describe2 marks

A programmer has written two programs to sort the same list, one using a bubble sort and one using a merge sort.

Describe how the programmer could use test data to find out which program sorts the list more efficiently.

[2 marks]
Mark scheme

Award up to two marks for a linked description such as:

  • Run both programs on the same set of test data (1) and count/record the number of comparisons each one makes (1)
  • Run the programs on lists of different sizes (1) to see how the number of comparisons/passes changes as the list gets bigger (1)
  • Time each program as it sorts the same test data (1) so the program that takes less time can be chosen (1)
  • Use test data that is already in order (1) to see whether the number of passes through the loop changes (1)

Allow 'count the passes' as an alternative to 'count the comparisons'.

Do not accept 'see which one is faster/more efficient' with no reference to counting comparisons/passes or to measuring the time taken.

Do not accept descriptions of how either sort works, such as comparing and swapping items or splitting the list in half.

Example answers and how they were marked
Full marks2/2

Run both programs on the same test data and record how many comparisons each one makes. Then run them both again on a much larger list to see how the number of comparisons changes.

Why: Same test data with comparisons counted (1) and different sized lists to compare how the count grows (1).

Some marks1/2

Time each program while it sorts the list.

Why: Timing point (1) but no linked development saying the times are compared to choose the quicker program (0).

No marks0/2

Merge sort is more efficient because it splits the list in half until every list has one item in it.

Why: Describes how a merge sort works rather than using test data to compare the programs, which the mark scheme says is not accepted, so no mark.

10Explain2 marks

A program puts a list of test scores into ascending order using a bubble sort.

Explain how one pass through the list moves the highest score to the end of the list.

[2 marks]
Mark scheme

Award up to two marks for a linked explanation such as:

  • Neighbouring/adjacent items are compared and swapped if they are in the wrong order (1) so the highest score is swapped one place to the right each time and keeps moving along the list (1)
  • The larger item of a pair is swapped to the right (1) and is then compared with the next item, so the highest score works its way to the end of the list (1)
  • The highest score is compared with the item to its right (1) and swapped with it, so it moves one place right on each comparison until it reaches the end (1)
  • The list is worked through from left to right, comparing and swapping pairs (1) so the largest value is carried along to the end of the list (1)

For both marks, the expansion must follow/associate with the statement.

Allow one mark for a correct description of the comparison/swap of neighbouring items on its own, e.g. 'items next to each other are swapped if they are in the wrong order' (1), where it is not linked to the highest score reaching the end.

Do not accept 'it puts the list in order' / 'it sorts the scores' on its own, as this repeats the question without saying how.

Do not accept descriptions of a different sorting algorithm, e.g. finding the smallest score in the list and moving it to the front.

Example answers and how they were marked
Full marks2/2

Each score is compared with the one next to it and swapped if it is larger, so the highest score keeps moving to the right until it reaches the end of the list.

Why: Point (1) for comparing and swapping neighbouring items, linked reason (1) for the highest score moving right until it reaches the end.

Some marks1/2

Items next to each other are swapped if they are in the wrong order, so the scores are put into ascending order.

Why: Earns the single mark allowed for describing the comparison/swap of neighbouring items (1); the second half only restates the outcome and is not linked to the highest score reaching the end.

No marks0/2

It finds the smallest score in the list and moves it to the front, then repeats this for the next position.

Why: Describes a selection sort, not a bubble sort: no adjacent comparison or swap, so no creditworthy point.

11Explain2 marks

A merge sort is used to sort a list of customer names.

Explain how the list is divided during the divide stage of a merge sort.

[2 marks]
Mark scheme

Award up to two marks for a linked explanation such as:

  • The list is divided in half repeatedly (1) until each sub-list contains a single item (1)
  • The list is split into two halves (1) and each half is split again until the sub-lists are one item long (1)
  • Each sub-list is halved again and again (1) until it cannot be divided any further (1)
  • Single-item sub-lists are produced (1) because the list is repeatedly divided into two (1)

For both marks, the expansion must follow/associate with the statement.

Do not accept descriptions of comparing items or merging sub-lists, as these happen in the merge stage, not the divide stage.

Example answers and how they were marked
Full marks2/2

The list is divided in half again and again until each sub-list has only one item in it.

Why: Linked point (1) and reason (1): repeated halving with the stopping condition of single-item sub-lists.

Some marks1/2

The list is split into two halves and then the two halves are merged back together in order.

Why: One mark for splitting the list into halves; merging belongs to the merge stage, so there is no linked expansion for the divide stage.

No marks0/2

It compares each pair of items and swaps them if they are in the wrong order until the list is sorted.

Why: Describes a bubble sort; nothing about dividing the list, so neither the point nor a linked reason is given.

12Explain2 marks

A merge sort and a bubble sort can both be used to sort the same list. The list contains 50 000 items in a random, unsorted order.

Explain why the merge sort will be more efficient than the bubble sort for this list.

[2 marks]
Mark scheme

Award up to two marks for a linked explanation such as:

  • The merge sort makes fewer comparisons (1) because the list is repeatedly halved, so each item is compared with far fewer other items (1)
  • The bubble sort makes far more comparisons as the list gets longer (1) because every pass compares every neighbouring pair of items in the whole list (1)
  • The merge sort does less work when combining the sub-lists (1) because each merge only compares the front item of two lists that are already sorted (1)
  • The bubble sort needs many passes over the list (1) because each pass only moves one item into its final position, so passes repeat until no swaps are needed (1)

For both marks, the expansion must follow/associate with the statement.

Do not accept 'it is faster/quicker' or 'it is more efficient' on its own without a linked reason.

Do not accept 'the merge sort uses less memory', as a merge sort uses more memory than a bubble sort.

Example answers and how they were marked
Full marks2/2

The merge sort makes fewer comparisons because the list is halved again and again, so each item is compared with far fewer other items.

Why: Linked point (1) and reason (1): fewer comparisons explained by the repeated halving of the list.

Some marks1/2

The merge sort makes fewer comparisons than the bubble sort, so it is more efficient.

Why: One creditworthy point (fewer comparisons); the second half only restates the question and gives no linked reason.

No marks0/2

The merge sort is better because it uses less memory than the bubble sort.

Why: Misconception from the examiners' report: a merge sort uses more memory, so this earns nothing.

13Discuss6 marks

A village library has a program that sorts a list of 40 book titles into alphabetical order. The program runs once each morning on the library's desktop computer. The programmer is deciding whether to use a bubble sort or a merge sort.

Discuss whether the programmer should use a bubble sort or a merge sort to sort the book titles.

Your answer should consider:

  • how each sort algorithm works
  • the number of comparisons each sort makes
  • which sort is more suitable for the library's program.
[6 marks]
Mark scheme

Indicative content

How bubble sort works

  • Bubble sort compares each title with the one next to it and swaps them if they are in the wrong alphabetical order.
  • Each pass moves the last unsorted title into its correct place at the end of the list, so the next pass can stop one title earlier and makes one fewer comparison than the pass before.
  • Passes are repeated until a pass makes no swaps, which shows that the list is sorted.
  • Sorting 40 titles could take up to 39 passes through the list.
  • Bubble sort is an in-place sort, so the titles are rearranged inside the original list without creating a second list.

How merge sort works

  • Merge sort splits the list in half again and again until each sub-list holds a single title.
  • The sub-lists are then merged in pairs, repeatedly taking the title that comes first alphabetically from the front of each sub-list.
  • Merging continues until one sorted list of 40 titles remains.
  • Merge sort is a divide and conquer algorithm because it keeps dividing the list and then merges the sorted parts.

Number of comparisons

  • In the worst case bubble sort makes 39 + 38 + ... + 1 = 780 comparisons for 40 titles, because adjacent titles are compared again on every pass and the number of comparisons falls by one on each pass.
  • Merge sort makes far fewer comparisons, roughly 200 for 40 titles, because it needs about six rounds of splitting and merging and each round compares at most 40 titles; this figure is approximate, so accept any figure between about 150 and 250 that is given with a valid basis.
  • Merge sort compares fewer titles because each merge only compares the titles at the front of the two sub-lists, not every pair.
  • Fewer comparisons means the merge sort finishes sooner, but with only 40 titles both sorts finish in a fraction of a second.

Suitability

  • Either sort is fit for purpose, because 40 titles is a small list and the program runs only once each day.
  • Bubble sort is shorter and simpler to write and to check, which suits a small program like this one, so bubble sort can be recommended.
  • Merge sort keeps extra sub-lists in memory, but this is not a problem on a desktop computer with plenty of RAM, so merge sort can also be recommended.
  • Merge sort would be the better choice if the library later sorted a much larger catalogue, as its number of comparisons grows more slowly as the list gets longer.

Levels

  • Level 0 (0 marks): No rewardable content.
  • Level 1 (1–2 marks): Basic, independent points are made, showing elements of understanding of key concepts/principles of computer science. (AO1) The discussion will contain basic information with little linkage between points made or application to the context. (AO2)
  • Level 2 (3–4 marks): Demonstrates adequate understanding of key concepts/principles of computer science. (AO1) The discussion shows some linkages and lines of reasoning with some structure and application to the context. (AO2)
  • Level 3 (5–6 marks): Demonstrates comprehensive understanding of key concepts/principles of computer science to support the discussion being presented. (AO1) The discussion is well developed, with sustained lines of reasoning that are coherent and logically structured, and which clearly apply to the context. (AO2)

Level 3 answers must describe how both sorts work, compare their efficiency (number of comparisons, passes through the list or use of memory) and give a justified recommendation; either sort may be recommended, provided the reasoning is justified. Responses that only describe the two sorts, with no comparison of efficiency and no recommendation linked to the library's program, are limited to Level 2, and basic, unlinked descriptions of the two sorts are Level 1. Do not accept claims that merge sort uses less memory than bubble sort, or that a bubble sort divides the list in half.

Example answers and how they were marked
Full marks6/6

A bubble sort compares each title with the one next to it and swaps them if they are in the wrong order. Each pass pushes the last unsorted title into its place, so the next pass makes one fewer comparison, and 40 titles need at most 39 passes. A merge sort splits the list in half until every sub-list holds one title, then merges the pairs back together, taking the smaller title from the front of each list each time. Bubble sort makes 39 + 38 + ... + 1 = 780 comparisons in the worst case for 40 titles, whereas merge sort makes roughly 200, because each merge only compares the titles at the front of its two sub-lists. Merge sort is therefore the more efficient algorithm, but 40 titles is a small list, so the difference in speed will not be noticed when the program runs once each morning, and bubble sort is simpler for the programmer to write and test. Merge sort also needs extra memory for its sub-lists, which does not matter on a desktop computer. I would use bubble sort because the list is small, unless the library expects a much bigger catalogue later.

Why: Describes both algorithms (bubble sort swaps neighbours and makes one fewer comparison each pass; merge sort divides then merges), compares the number of comparisons with figures (1.2.7), and gives a justified recommendation applied to the library's 40 titles and desktop computer. Sustained, coherent and applied: Level 3, 6 marks.

Some marks2/6

A bubble sort looks at each item and swaps it with the next one if it is bigger, and it repeats this until there are no swaps. A merge sort is a divide and conquer algorithm that splits the list in half until there is one item in each list and then merges them back together in order. Both of them will sort the 40 book titles into alphabetical order. Bubble sort is easier to write but merge sort is faster.

Why: Two basic, independent descriptions of how each sort works (AO1) with no comparison of the number of comparisons, passes or memory, and a suitability point that is a bare assertion not linked to the library's 40 titles or daily run. Little linkage and little application to the context: Level 1, 2 marks.

Some marks1/6

Merge sort should be used because it is a divide and conquer algorithm and it uses less memory than a bubble sort. A bubble sort splits the list in half repeatedly, which takes a long time.

Why: 'Merge sort is a divide and conquer algorithm' is a correct basic description of how it works (1). The memory claim is the common misconception that merge sort is cheaper, and a bubble sort does not split the list in half, so neither is credited: Level 1, 1 mark.

14Discuss6 marks

A weather station records a temperature reading every minute. Each night a program sorts that day's readings, which can be up to 100 000 of them, into ascending order. The program runs on a small device with limited memory.

Discuss the issues the developer should consider when choosing between a bubble sort and a merge sort for this program.

Your answer should consider:

  • the memory each sort needs
  • how the size of the list affects the time each sort takes
  • which sort the developer should choose.
[6 marks]
Mark scheme

Indicative content

Memory

  • Bubble sort sorts the readings in place, swapping items inside the original list, so it needs only a small, fixed amount of extra memory however many readings there are. (accept: a constant amount of extra memory that does not grow with the number of readings)
  • Merge sort is out-of-place, so new sub-lists are created at every split and extra memory is needed for them. (accept: merge sort needs an extra temporary list/array; merge sort needs extra memory that grows with the number of readings)
  • The extra memory merge sort needs grows with the number of readings, so with up to 100 000 readings it could be more than the small device has.
  • If the device runs out of memory, the program could crash or that night's readings might not be sorted.
  • Bubble sort is therefore the safer sort for a device with limited memory.

Effect of the size of the list on time

  • Bubble sort's number of comparisons grows roughly with the square of the number of readings, so sorting 100 000 readings would take a very long time.
  • A bubble sort could need up to 99 999 passes over the list, whereas merge sort needs only about 17 rounds of splitting and merging. (accept: about log n rounds; accept merge sort makes roughly n log n comparisons)
  • Merge sort's number of comparisons grows far more slowly as the list gets longer, so it copes far better with 100 000 readings.
  • The program runs once a night, so there is a long time before the next day's readings are recorded, which may mean even a slow sort finishes in time.

Choice

  • There is a trade-off, because the sort that is much faster on 100 000 readings is also the one that needs more memory.
  • If the device has enough memory, merge sort should be chosen because it will sort the day's readings far more quickly.
  • If memory is too tight, bubble sort may be the only sort that will run on the device, even though it will be slow.
  • The developer could test both sorts with a full day's readings to see how long each takes and whether the device runs out of memory.

Levels

  • Level 0 (0 marks): No rewardable content.
  • Level 1 (1–2 marks): Basic, independent points are made, showing elements of understanding of key concepts/principles of computer science. (AO1) The discussion will contain basic information with little linkage between points made or application to the context. (AO2)
  • Level 2 (3–4 marks): Demonstrates adequate understanding of key concepts/principles of computer science. (AO1) The discussion shows some linkages and lines of reasoning with some structure and application to the context. (AO2)
  • Level 3 (5–6 marks): Demonstrates comprehensive understanding of key concepts/principles of computer science to support the discussion being presented. (AO1) The discussion is well developed, with sustained lines of reasoning that are coherent and logically structured, and which clearly apply to the context. (AO2)

Additional guidance

  • Level 3 responses must consider both the memory each sort needs and the effect of the size of the list, and must reach a justified choice. A conditional choice, such as merge sort if the device has enough memory and bubble sort otherwise, is a justified choice and can reach Level 3.
  • An answer that deals with only one of memory and the size of the list, even when it applies that point to the device, is limited to 3 marks (Level 2 lower).
  • A recommendation that is not justified by the device's limited memory or by the time before the next day's readings is a basic point and will not, on its own, support Level 3.
  • Do not credit the claim that merge sort uses less memory than bubble sort, because merge sort is out-of-place and needs extra memory for its sub-lists.
  • Do not credit the claim that bubble sort is always quicker, or that merge sort is quicker, without considering how the number of readings affects the number of comparisons.
Example answers and how they were marked
Full marks6/6

A bubble sort works in place, so it needs only a small, fixed amount of extra memory however many readings are stored. A merge sort is out-of-place: every split creates new sub-lists, so the extra memory it needs grows with the number of readings, and with up to 100 000 readings this could be more than the small device can hold, which might make the program crash. On the other hand, a bubble sort's number of comparisons grows roughly with the square of the list length, so sorting 100 000 readings could need up to 99 999 passes and take a very long time, while merge sort needs only about 17 rounds of splitting and merging. The developer should therefore choose merge sort if the device has enough memory, because it will finish far sooner, and only fall back to bubble sort if memory is too tight, even though it will be slow.

Why: Explains in-place versus out-of-place memory use and applies it to the limited device, then contrasts how comparisons and passes grow with list size (1.2.7), and ends with a conditional, justified choice tied to the 100 000 readings. Level 3.

Some marks3/6

A merge sort creates new lists every time it splits the original list, so it uses more memory than a bubble sort, which sorts the list where it is and does not make any new lists. The weather station device has limited memory, so this matters because the program might not fit. Merge sort will be quicker than bubble sort for the readings.

Why: The memory difference is explained and applied to the device, which is a sound contextualised point. The speed point is only asserted, with no reference to how the number of comparisons grows with the size of the list, and no choice is made, so the answer is single-aspect: capped at Level 2 lower, 3 marks.

Some marks1/6

Bubble sort sorts the list in place because it only swaps readings that are next to each other, so it does not need extra memory. Merge sort should be used because it uses less memory than bubble sort and will easily fit on the small device.

Why: The in-place description of bubble sort is one correct basic point (1). The claim that merge sort uses less memory is the common misconception and is not credited, and there is no reasoning about the size of the list. Level 1.

Keep practising Sorting Algorithms

More exam questions on 1.2 Algorithms

Teachers: print these as a worksheet with the mark schemes at the end, and sign your school up to set your classes activities on Sorting Algorithms.

Fetch Decode Explain isn't affiliated with or endorsed by Pearson Edexcel.