Searching on a Line: A Complete Characterization of the Optimal