1.2 Algorithm Efficiency
1.2 Algorithm Efficiency
Efficiency of Algorithms
Contents
Algorithm Efficiency
Page 1 of 3
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Algorithm Efficiency
Your notes
Algorithm Efficiency
What is algorithm efficiency?
Algorithm efficiency is how much time it takes to complete an algorithm
In programming, there is often more than one algorithm which can solve a problem
An example of this is a linear search and binary search as both find a value in a list, however, depending
on the circumstances, one may be much faster than the other
Efficiency in action
If we took the numbers 1-20 jumbled up in a list
How efficient an algorithm is would be determined by how quickly it could sort the numbers into
ascending order
DEFINE listToSort AS a list of integers containing the DEFINE listToSort AS a list of integers containing the
numbers 1 to 20 numbers 1 to 20
SET lengthOfList TO the length of listToSort SET lengthOfList TO the length of listToSort
Page 2 of 3
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
In the algorithms above, the worst case of a bubble sort is that it would take 361 comparisons to sort
20 items of data
Your notes
The worst case of an insertion sort with 20 items is that it would perform 190 comparisons
This means that in this instance, although both algorithms perform the same job and achieve the same
result, an insertion sort would be significantly faster because it is much more efficient in how it uses
the computer’s processing power and memory
Page 3 of 3
© 2015-2025 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers