How is it possible to do binary search on a singly-linked list in O(n) time?
This earlier question talks about doing binary search over a doubly-linked list in O(n) time. The algorithm in that answer work as follows: Go to the middle of the list to do the first comparison. If it's equal to the element we're looking for, we're done. If it's bigger than the element we're looking for, walk backwards halfway to the start and repeat. If it's smaller than the element we're looking for, walk forwards halfway to the start and repeat. This works perfectly well for a doubly -linked list because it's possible to move both forwards and backwards, but this algorithm wouldn't work