← Back to Dashboard

2.3 Algorithms

A-Level Computer Science

1. Poppy would like to use a bubble sort to sort 250 000 numbers into order from lowest to highest.

Discuss how a bubble sort works and how efficient it will be when sorting these 250 000 numbers.
[9]
Login to save your answers
/ 9
2. Two other sorting algorithms are merge sort and quick sort.
Compare the use of merge sort, quick sort and insertion sort on an array with a small number of items and on an array with a large number of items.

Make reference to time complexities using the Big O notation.
[9]
Login to save your answers
/ 9
3. Trudi would like to sort an array of numbers into order. The numbers before they have been sorted can be seen here.
Trudi will use a bubble sort to put these numbers into order from smallest to largest. Show the first pass of the bubble sort. You should clearly show each comparison made
[4]
Question Image
Login to save your answers
/ 4
4. A computer program stores data in an array named words.
a) The data in the array needs to be searched for a value that the user inputs. One example of a searching algorithm is a binary search. Identify the precondition for a binary sear
[1]
Login to save your answers
/ 1
b) A second example of a searching algorithm is a linear search.
Describe how a linear search works.
[4]
Login to save your answers
/ 4
5. This bubble sort algorithm is written to sort numberArray into ascending numerical order. Complete this bubble sort algorithm.
[5]
ArrayLength = tempValue = 0 do flag = false for y = 0 to arrayLength - if numberArray[y] > numberArray[y + 1] then = numberArray[y] numberArray[] = numberArray[y + 1] numberArray[y + 1] = flag = true endif next y until flag == false
/ 5
Please login to save your answers and marks.