Skip to content

Instantly share code, notes, and snippets.

View perezd's full-sized avatar
🦾
More Perfect Protobuf

Derek Perez perezd

🦾
More Perfect Protobuf
View GitHub Profile
@perezd
perezd / binary-search.coffee
Created September 13, 2011 21:46 — forked from mythz/binary-search.coffee
Side by Side: CoffeeScript vs JavaScript - Algorithms Edition
# All CoffeeScript examples from: https://github.com/jashkenas/coffee-script/blob/master/examples/computer_science/
# All Java Script examples from: https://github.com/nzakas/computer-science-in-javascript - Copyright (c) 2009 Nicholas C. Zakas
# - Released under https://github.com/nzakas/computer-science-in-javascript/blob/master/LICENSE (*.js copyright headers reduced for clarity)
# Uses a binary search algorithm to locate a value in the specified array.
binary_search = (items, value) ->
start = 0