Scrapbook-0.4.0: code examples
Copyright© Frank Jung 2020
LicenseGPL-3
Safe HaskellSafe-Inferred
LanguageHaskell2010

BinarySearch

Description

Example implementation of binary search.

Synopsis

Documentation

bsearch :: Ord a => [a] -> a -> Maybe a Source #

Binary Search

Example using an integer array, search list [1..6] for values [1..8].

Expect 1..6 will return Just values, while 7 and 8 will return Nothing.

The same also applies for strings. Try "abcdef" and "gh".