Back to Efficiency Of Algorithms

Oak National Academy

Lessons written by expert teachers in England, each with slides, a video and quizzes.

Their topic:
Searching and sorting algorithms
For your topic:
Efficiency Of Algorithms · Computer Science - 9210

Use these lessons alongside our lesson note, which covers your syllabus in full.

What this covers in your syllabus

3 lessons from Oak National Academy

Lesson 1 of 3 · GCSE level, ages 14 to 16

Code sorting algorithms

By the end: I can trace code for a sorting algorithm to identify factors which may impact efficiency.

Key learning points

  1. Code for sorting algorithms can be analysed by how efficient the algorithm is.
  2. A trace table can be used to analyse an algorithm.
  3. Bubble sort compares elements next to each other in the list and swaps them if they are in the wrong order.
  4. A more efficient version of bubble sort uses a variable to flag when a swap was made during a single pass.

Keywords

trace table
a tool used to track the values of variables and the flow of execution in an algorithm or program, step by step
efficiency
in sorting algorithms, efficiency refers to how effectively an algorithm uses resources (time and space) while sorting a list of data

A common mistake

Mistake: Bubble sort is a fast and efficient sorting algorithm.

In fact: Bubble sort is considered inefficient for large data sets, but it can be made more efficient by using a flag to indicate when a swap is made in a single pass.

Check what you learned

From Oak National Academy's exit quiz. Choose every answer that is right.

What is the purpose of a trace table in programming?
Which of the following statements is true about bubble sort?
How can the performance of bubble sort be improved?
What does the efficiency of a sorting algorithm refer to?
You have been given some playing cards that have not been sorted. The cards are in the following order 4, 8, 5, 2, 9 State the order of the cards after the first pass of the bubble sort algorithm.

A computing lesson by Oak National Academy licensed under the Open Government Licence (OGL) v3.0. Read the licence

Lesson 2 of 3 · GCSE level, ages 14 to 16

Coding sorting algorithms

By the end: I can trace code for a sorting algorithm to identify factors which may impact efficiency.

Key learning points

  1. Code for sorting algorithms can be analysed by how efficient the algorithm is.
  2. A trace table can be used to analyse an algorithm.
  3. Bubble sort compares elements next to each other in a list and swaps them if they are in the wrong order.
  4. A more efficient version of bubble sort uses a variable to flag when a swap was made during a single pass.
  5. The insertion sort algorithm copies the value to be inserted in a variable at the start of each pass.

Keywords

trace table
a tool used to track the values of variables and the flow of execution in an algorithm or program, step by step
efficiency
in sorting algorithms, efficiency refers to how effectively an algorithm uses resources (time and space) while sorting a list of data

A common mistake

Mistake: Bubble sort is a fast and efficient sorting algorithm.

In fact: Bubble sort is considered inefficient for large data sets, but it can be made more efficient by using a flag to indicate when a swap is made in a single pass.

Check what you learned

From Oak National Academy's exit quiz. Choose every answer that is right.

What is the purpose of a trace table in programming?
Which of the following statements is true about bubble sort?
How can the performance of bubble sort be improved?
What does the efficiency of a sorting algorithm refer to?
Which sorting algorithm is better for small or partially sorted datasets?

A computing lesson by Oak National Academy licensed under the Open Government Licence (OGL) v3.0. Read the licence

Lesson 3 of 3 · GCSE level, ages 14 to 16

Comparing searching algorithms

By the end: I can compare and contrast linear and binary search and trace the code for both searching algorithms.

Key learning points

  1. The searching algorithm you use will depend on the data and context you are using.
  2. Coding a binary search is more complex than a linear search.
  3. Tracing code for searching algorithms by completing a trace table can help you check how efficient the algorithm is.

Keywords

algorithm
a set of step-by-step instructions to solve a problem
trace table
a tool used to track the values of variables and the flow of execution in an algorithm or program, step by step

A common mistake

Mistake: A linear search algorithm and binary search algorithm are equally complex to write.

In fact: Binary search algorithms are more complex to write due to the different paths that the algorithm can take rather than stepping through the search data in order.

Check what you learned

From Oak National Academy's exit quiz. Choose every answer that is right.

What is a trace table used for?
Which searching algorithm is more complex to write?
Which of these is true about linear search?

A computing lesson by Oak National Academy licensed under the Open Government Licence (OGL) v3.0. Read the licence

The wording comes from each publisher. The layout and the links to your syllabus are ours.