If you're going to do a search through any set of items for a single target, it doesn't have to be a linear search, you can do a binary search. So, in your case, that means loading up half your "possible culprit" books all at once. Check if the problem exists. If so, then take that set, cut it in half, and reapply the process -- if the problem doesn't exist, then use the other half of possible books instead. Repeat until the culprit book is found. With this algorithm, you should be able to find the culprit book among 1024 books in about 10 checks (10 cuts), not 1023 checks.
|