Photo AI
Question 6
P-Cubed uses GPS to track its delivery vans. (i) Here is the pseudo-code for an algorithm to find the number of mileages over 300. SET maximum TO LENGTH (mileage) ... show full transcript
Step 1
Answer
One inefficiency in executing the algorithm with this dataset is that it does not take advantage of any potential sorting in the data. Since the algorithm processes each element in a random order and compares it against the threshold (300), it must examine all items in the list regardless of whether there are any items above 300. If the data were sorted in ascending order, the algorithm could stop searching once it encounters the first number greater than 300, thus saving time by not checking the remaining numbers.
Report Improved Results
Recommend to friends
Students Supported
Questions answered