BILINGUAL WORD CARD · RANK 87

binary search

📖 Halving the search interval at every step

Search algorithm running in O(log N) time.

中文对照 · Chinese

📖 翻字典总是先翻正中间那一页

在有序数据中每次排除一半,100 万个数字最多只需查 20 次!

Code example

int mid = low + (high - low) / 2;
Explore 100 bilingual word cards →