AlgorandSIMULATION v1.0
Sequential Engines(17)
Parallel Engines
Binary Search
sequentialRAMAn efficient algorithm for finding an item from a sorted list of items by repeatedly halving the search interval.
SIMULATION STEP PROGRESSStep 1 / 1
SPEED (50%)
SIZE (12)
💡 Tip: Enter integers between 1 and 99. Max size is 16.
Code Workspace
1procedure binarySearch(A, target)
2 low := 0, high := length(A) - 1
3 while low <= high do
4 mid := floor((low + high) / 2)
5 if A[mid] == target then
6 return mid
7 else if A[mid] < target then
8 low := mid + 1
9 else
10 high := mid - 1
11 end if
12 end while
13 return -1
14end procedure
Currently highlights executing branch
RUNTIME COST METRICS
Comparisons0
Memory Writes0
Memory Reads0
Elements Swapped0
Computational Model:RAM (Single Core)
Theoretical Bound:O(log N)
Space Complexity:O(1)
Communication Cost:0 (Shared Bus)
THEORETICAL ANALYSIS & RESEARCH
Conceptual Focus: An efficient algorithm for finding an item from a sorted list of items by repeatedly halving the search interval.
Real-world Industrial Applications:
- Database querying and primary key indexes
- Debugging via git bisect to find broken commits