Algorithm Efficiency (AQA GCSE Computer Science)
Revision Note
Written by: James Woodhouse
Reviewed by: Lucy Kirkham
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
Sort 1 (Bubble sort) | Sort 2 (Insertion sort) |
---|---|
|
|
In the algorithms above, the worst case of a bubble sort is that it would take 361 comparisons to sort 20 items of data
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
Last updated:
You've read 0 of your 10 free revision notes
Unlock more, it's free!
Did this page help you?