Algorithms and programming June 2025, Question 2 14 marks
2* A shopping website requires customers to create a username and password.
The usernames and passwords are stored securely in a file. The file contains the username and passwords for 50 million users which are sorted in alphabetical order by username.
The file can be searched using a linear search or a binary search.
The big-O complexities for a linear search and a binary search are given in the table:
| Search algorithm | Worst-case time | Average-case time | Worst-case space |
| Linear | O(n) | O(n) | O(1) |
| Binary | O(log n) | O(log n) | O(1) |
Compare the use of a linear search and a binary search in this scenario.
You should include the following in your answer:
• the features and preconditions of a linear and binary search
• the benefits and drawbacks of each search in this scenario
• a conclusion justifying which search algorithm should be used in this scenario.
You should make reference to the big-O complexities in your answer.
Reveal mark scheme
The website collects data from customers’ activities once they log on. For example, the items they view and purchase. The company that owns the website would like to use data mining to improve their website and customer experience.
Describe what data mining means.
Reveal mark scheme
Explain how the company can make use of data mining to improve their website and customer experience.
Reveal mark scheme