Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mtchavez/binary-search-erl

Binary Search in Erlang
https://github.com/mtchavez/binary-search-erl

binary-search erlang

Last synced: about 2 months ago
JSON representation

Binary Search in Erlang

Awesome Lists containing this project

README

        

binary-search-erl
=================

[![Build Status](https://travis-ci.org/mtchavez/binary-search-erl.png?branch=master)](https://travis-ci.org/mtchavez/binary-search-erl)

Binary Search in Erlang

## Usage

Takes a list of integers to run a binary search on.

### Searching

With a list you can search for a specific value

```erlang
c(binarysearch).
List = [5,1,4,6,-1,40,203,8,343,1,-1212, 55].
binarysearch:search(List, 343).
% returns {{value, 343}, {position, 12}}
```

When there are no results this is what will be returned

```erlang
c(binarysearch).
List = [5,1,4,6,-1,40,203,8,343,1,-1212, 55].
binarysearch:search(List, 999).
% returns {notfound, 999}
```

### Running Tests

Tests can be run with ```rebar eunit```.

Coverage will be output at ```.eunit/index.html```

## License

Written by Chavez

Released under the MIT License: http://www.opensource.org/licenses/mit-license.php