binary search on sorted indexes