Exam-style question
Try this first
A student needs to find a specific word in an extremely long document (millions of words). The document is currently just plain text, with words appearing in no particular order. The student plans to perform the search multiple times for different words. Advise the student on which standard searching algorithm would be most efficient for their task, justifying your choice and outlining steps they might take to use it. [6 marks].
Answer and explanation
Concise answer
The student should initially sort the document and then use Binary Search for repeated searches.
Why this is correct
1 mark for suggesting to sort the document first. 1 mark for identifying Binary Search as the most efficient searching algorithm for repeated searches on a sorted list. 1 mark for justifying why Linear Search would be inefficient for repeated searches on a large unsorted list. 1 mark for suggesting an appropriate sorting algorithm like Merge Sort for the initial sorting task.
Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.
Common mistake
No common mistake is linked to this question yet.
