P-Cubed uses GPS to track its delivery vans - Edexcel - GCSE Computer Science - Question 6 - 2018 - Paper 1
Question 6
P-Cubed uses GPS to track its delivery vans.
(a) Programmers are working on algorithms to track the mileage of the delivery vans.
Programmers are testing the algori... show full transcript
Worked Solution & Example Answer:P-Cubed uses GPS to track its delivery vans - Edexcel - GCSE Computer Science - Question 6 - 2018 - Paper 1
Step 1
Describe one inefficiency when executing the algorithm with this dataset.
96%
114 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
One inefficiency of the algorithm is that it uses a linear search method to find mileages over 300 in an unsorted dataset. It has to check every element in the array, which means that it performs unnecessary comparisons, even when most values are known to be less than 300. This results in a lack of optimization, as the algorithm does not take advantage of any potential sorting within the dataset. If the data were sorted, it could stop searching early once it finds a number less than or equal to 300.