i = 512 l = -1 if x[511] < t l = 1000 - 512 while i != 1 /* инвариант: x[l] < t && x[l+i] >=t && i = 2^j */ nexti = i / 2 if x[l + nexti] < t l = l + nexti i = nexti else i = nexti /* утверждение: i == 1 && x[l] < t && x[l+i] >= t */ p = l+1 if p > 1000 || x[p] != t p = -1