title: tightest bounds algorithm search
body: <p>I'm looking for an algorithm that gets sorted array of n int and int x, <code>while A[1]&lt;=x&lt;=A[n]</code> but not has to be in the array, and return a pair (ub,lb) when <code>lb ≥ x ≥ ub</code> are the tightest bounds.</p>
  
  <p>Anyone know something like that?</p>