A function takes an unsorted list and returns the largest value. A teacher asks students to trade off two implementations: one scans the list once, the other sorts the list first and takes the last element. Which trade-off statement is most accurate?
- AThe single scan is generally faster because it avoids the extra cost of sorting
- BSorting first is always faster than a single scan
- CBoth approaches always take exactly the same time
- DNeither approach can find the maximum value