Binary search compares the midpoint of a sorted collection and eliminates half of the
remaining values after each comparison. Its time complexity is
O(log N).
Loading bar chart…
Binary search traversal showing 20 bars for value.
Values: index 0: 15.0, index 1: 20.0, index 2: 21.0, index 3: 22.0, index 4: 25.0, index 5: 29.0, index 6: 47.0, index 7: 48.0, index 8: 61.0, index 9: 62.0, index 10: 66.0, index 11: 68.0, index 12: 70.0, index 13: 82.0, index 14: 83.0, index 15: 87.0, index 16: 95.0, index 17: 96.0, index 18: 98.0, and index 19: 100.0.