See what we can offer to your school
"SimpleStudy just makes sense...”
Get the best plan for your school
12 cards from this deck
Efficient algorithm to find target position in sorted dataset
Data must be sorted
O(1)O(1)O(1) - target is middle element
O(logn)O(\log n)O(logn) - halves search space each step
O(1)O(1)O(1)
O(logn)O(\log n)O(logn) due to call stack
Search left half
Search right half
Binary Search is much faster
Only works on sorted data, gives incorrect results
Return -1 when low > high (target not found)
Divides search interval in half each iteration
Select your subjects, and get access to A+ resources today.