About this question

Binary Search Comparisons on Sorted Price Levels

Easy · Algorithms & Data Structures · Quant Trader interview question · binary-search, algorithms, data-structures, logarithm, trading

You are building a high-frequency trading system and need to quickly find specific price levels within the order book. The order book contains a sorted array of 1 million unique price levels. You implement a binary search algorithm to locate the desired price. What is the maximum number of comparisons the binary search algorithm will need to make in the worst-case scenario to find (or determine the absence of) a target price within the array?