O(logN) Time Complexity