Font size
WorksheetsSorting algorithms (Y11)
Total questions: 20
Worksheet time: 11mins
What is a sorting algorithm?
Specific instructions which allow us to understand code
Specific instructions which allow us to organise data in a particular way
Kinda like a word-scrambler
Kinda like a password-decrypter
What is the most important reason that data needs to be sorted?
It is organised and easier to make sense of.
So it looks nice.
To show we can do it.
Which of the following are sorting algorithms?
Binary, linear
Numerical, phonetic
Bubble, merge
File, alphabetical
How do bubble sorts work?
They split the list to single elements before piecing them back together, one sublist at a time.
Each item in the list is compared with the following item starting with the last value till the first.
Taking one item at a time from an unsorted list, each new item is compared with the previous until its place is found.
Each item in the list is individually compared with the following item starting with the first value till the last.
What is an advantage of a bubble sort?
It is difficult to implement.
It is fast.
It uses less memory.
It is easier to implement and follow.
How do you calculate the maximum number of passes/iterations? Where n = number of elements in a list.
n - 1
n + 1
n(n+1)
n(n-1)
How many passes are required to sort a list with 5 elements?
5
4
10
2
The following list is to be sorted using a bubble sort:
12 6 8 1 3
What will the list look like after the first iteration/run through the list?
6 8 1 3 12
6 12 1 8 3
1 3 6 8 12
6 8 1 12 3
Why does a bubble sort do a final pass even when the data is in the correct order?
To save the data.
It does not recognise that the data is in order until the final pass requires no changes.
It needs to do this to put the data back in to a list.
To annoy the user.
What is a disadvantage of a bubble sort?
It takes a long time to implement.
It is difficult to follow and understand.
It uses less memory.
It requires many operations to complete.
How do merge sorts work?
They split the list to single elements before piecing them back together, one sublist at a time.
Each item in the list is compared with the following item starting with the last value till the first.
Taking one item at a time from an unsorted list, each new item is compared with the previous until its place is found.
Each item in the list is individually compared with the following item starting with the first value till the last.
The following two lists are to be merged, which element first goes into the new merged list?
List 1
2 4 7 9
List 2
1 6 8 12
0
1
2
3
The following two lists are to be merged, which element will be in position 5 in the new merged list?
List 1
2 4 7 9
List 2
1 6 8 12
8
7
6
4
Which of the following is an advantage of merge sorting?
It is cheap (computationally).
It's easy to understand.
It speeds up sorting slow-access data e.g. tape drive or hard disk.
Good for sorting slow-access data e.g. tape drive or hard disk.
For which of the problems would the bubble sort algorithm provide an appropriate solution. Choose all that apply.
Arranging a deck of cards from the lowest to the highest value cards.
Looking up a name in the phone book.
Sorting a stack of paper money into denominations -- i.e., £5, £10, £20 etc.
Sorting a basket of laundry into socks, shirts, shorts, and sheets.
Arranging books on a bookshelf by author's last name.
For what purpose would a merge sort algorithm be used?
To list items alphabetically.
To reorder a single list.
To combine identical lists together.
To reorder multiple lists into a singular ordered list.
Where would a merge sort be used?
To arrange files in a cupboard.
To arrange data in a computer folder.
To sort data on the fly.
To sort data that is too large to store in memory.
What is an advantage of merge sorts?
It can be applied to large data sets.
It is completed quickly.
It is computationally cheap.
What is a disadvantage of merge sort?
It can take up to half the amount of memory than that of the original list.
It is the best for sorting data that is normally accessed sequentially.
It can take up to double the amount of memory than that of the original list.
It is the worst at sorting data that is normally accessed sequentially.
