binary search and hash based