Find a value within a sorted array by dividing the search interval in half at each step.

Implementation

Usage

var index = new []{ 1, 2, 3}.BinarySearch(2);

Benchmarks

dotnet run --project ./Benchmarks/Benchmarks.csproj -c Release -- --job short --memory --f *BinarySearch*

Tests