Binary Search Algorithm
Algorithm Binary_Search Input // A, N, key// found <-- False left <-- 1 right <-- N while left<=right and (not found) do mid <-- (left + right) / 2 if A[mid] < key then left <-- mid + 1 else if A[mid] > key then right <-- mid - 1 else found <-- True end_if end_while Output // mid, found // End Binary_Search
Your browser does not support the
<canvas>
-element. Please think about updating your browser!
Run
Step
Pause
Stop
Speed
Insert Array Elements
Array A =
Insert
Search Key
Search Key =
Insert