Skip to main content
Back to course
Log in
Get started
Someone wanted to learn this too, so Grasp built them a personal learning path.
Create your own
Binary Search
·
Module 1
Monotone Predicates, Contracts, and Loop Invariants
1
Formulating Boundary-Finding Problems as Boolean Predicates
Reformulate a boundary-finding problem as a Boolean predicate over an ordered domain.
Reformulate a boundary-finding problem as a Boolean predicate over an ordered domain.
2
Checking Predicate Monotonicity for Binary Search
Determine whether a proposed predicate has the monotonicity required for binary search.
Determine whether a proposed predicate has the monotonicity required for binary search.
3
Choosing Search Bounds to Preserve Boundary Contracts
Choose inclusive or half-open search bounds that preserve a stated boundary contract.
Choose inclusive or half-open search bounds that preserve a stated boundary contract.
4
Loop Invariant for First-True Binary Search
State a loop invariant for a first-true binary search over an integer interval.
State a loop invariant for a first-true binary search over an integer interval.
5
Invariant-Preserving Updates for First-True Search
Derive invariant-preserving updates for a first-true search.
Derive invariant-preserving updates for a first-true search.
6
Deriving Last-True Search from First-True Boundaries
Derive a last-true search from the first-true boundary formulation.
Derive a last-true search from the first-true boundary formulation.
7
Overflow-Safe Midpoint Calculation for Signed Integers
Compute an overflow-safe midpoint for signed integer bounds.
Compute an overflow-safe midpoint for signed integer bounds.
8
Proving Termination and Partial Correctness of a Boundary-Search Loop
Prove termination and partial correctness of a boundary-search loop.
Prove termination and partial correctness of a boundary-search loop.
Next module isn't ready yet,
Back to course
Previous module
Next module