Improve the binary search by returning end pointer directly.