Popular recipes tagged "binary_search"http://code.activestate.com/recipes/tags/binary_search/2014-08-06T10:03:01-07:00ActiveState Code RecipesPython A* Pathfinding (With Binary Heap) (Python)
2014-08-06T10:03:01-07:00Christian Careagahttp://code.activestate.com/recipes/users/4186639/http://code.activestate.com/recipes/578919-python-a-pathfinding-with-binary-heap/
<p style="color: grey">
Python
recipe 578919
by <a href="/recipes/users/4186639/">Christian Careaga</a>
(<a href="/recipes/tags/algorithms/">algorithms</a>, <a href="/recipes/tags/binary_search/">binary_search</a>).
Revision 3.
</p>
<p>Implementation of the A-star Pathfinding algorithm in Python, using Binary heap to sort the open list</p>
Binary search function. (Python)
2011-02-07T06:37:52-08:00Kevin L. Sitzehttp://code.activestate.com/recipes/users/4173535/http://code.activestate.com/recipes/577565-binary-search-function/
<p style="color: grey">
Python
recipe 577565
by <a href="/recipes/users/4173535/">Kevin L. Sitze</a>
(<a href="/recipes/tags/binary/">binary</a>, <a href="/recipes/tags/binary_search/">binary_search</a>, <a href="/recipes/tags/bsearch/">bsearch</a>, <a href="/recipes/tags/functional/">functional</a>, <a href="/recipes/tags/lower_bound/">lower_bound</a>, <a href="/recipes/tags/optimal_solution/">optimal_solution</a>, <a href="/recipes/tags/search/">search</a>, <a href="/recipes/tags/upper_bound/">upper_bound</a>).
Revision 3.
</p>
<p>For a number of years Python has provided developers with the special parameters 'cmp' and 'key' on list.sort and __builtin__.sorted. However Python does not provide a built-in mechanism for doing binary searches on such sorted lists. This recipe provides a simple function that allows you to perform binary searches on your sorted sequences.</p>