wrote the binary search algorithm or something