Popular recipes by sivarama sarma http://code.activestate.com/recipes/users/4178890/2011-08-08T00:15:09-07:00ActiveState Code RecipesPython Binary Search Tree (Python) 2011-08-08T00:15:09-07:00sivarama sarmahttp://code.activestate.com/recipes/users/4178890/http://code.activestate.com/recipes/577830-python-binary-search-tree/ <p style="color: grey"> Python recipe 577830 by <a href="/recipes/users/4178890/">sivarama sarma</a> (<a href="/recipes/tags/algorithms/">algorithms</a>, <a href="/recipes/tags/maximum/">maximum</a>, <a href="/recipes/tags/minimum/">minimum</a>, <a href="/recipes/tags/search/">search</a>, <a href="/recipes/tags/sort/">sort</a>). </p> <p>A data structure that holds a sorted collection of values, and supports efficient insertion, deletion, sorted iteration, and min/max finding. Values may sorted either based on their natural ordering, or on a key function (specified as an argument to the search tree's constructor). The search tree may contain duplicate values (or multiple values with equal keys) -- the ordering of such values is undefined.</p> <p>This implementation was made with efficiency in mind. In particular, it is more than twice as fast as the other native-Python implementations I tried (which all use objects to store search tree nodes).</p> <p>See also: <a href="http://en.wikipedia.org/wiki/Binary_search_tree">http://en.wikipedia.org/wiki/Binary_search_tree</a>, <a href="http://en.wikipedia.org/wiki/A*_search_algorithm">http://en.wikipedia.org/wiki/A*_search_algorithm</a></p> Binary Search Tree (C++) 2011-08-08T00:13:44-07:00sivarama sarmahttp://code.activestate.com/recipes/users/4178890/http://code.activestate.com/recipes/577828-binary-search-tree/ <p style="color: grey"> C++ recipe 577828 by <a href="/recipes/users/4178890/">sivarama sarma</a> (<a href="/recipes/tags/algorithm/">algorithm</a>, <a href="/recipes/tags/algorithms/">algorithms</a>, <a href="/recipes/tags/datastructures/">datastructures</a>). </p> <p>Binary Search Tree.</p> Cache decorator in python 2.4 (Python) 2011-08-08T00:10:51-07:00sivarama sarmahttp://code.activestate.com/recipes/users/4178890/http://code.activestate.com/recipes/577827-cache-decorator-in-python-24/ <p style="color: grey"> Python recipe 577827 by <a href="/recipes/users/4178890/">sivarama sarma</a> (<a href="/recipes/tags/oop/">oop</a>). </p> <p>The latest version of Python introduced a new language feature, function and method decorators (PEP 318, <a href="http://www.python.org/peps/pep-0318.html" rel="nofollow">http://www.python.org/peps/pep-0318.html</a>). This recipe show a common callable transformation that can benefit from the new syntax, often referred to as Memoization pattern.</p> Bloom Filter (Python) 2011-08-08T00:14:35-07:00sivarama sarmahttp://code.activestate.com/recipes/users/4178890/http://code.activestate.com/recipes/577829-bloom-filter/ <p style="color: grey"> Python recipe 577829 by <a href="/recipes/users/4178890/">sivarama sarma</a> (<a href="/recipes/tags/big_table/">big_table</a>, <a href="/recipes/tags/bloom_filter/">bloom_filter</a>, <a href="/recipes/tags/sets/">sets</a>, <a href="/recipes/tags/spelling_checker/">spelling_checker</a>, <a href="/recipes/tags/spell_checker/">spell_checker</a>). </p> <p>Space efficient, probabilistic set membership tester. Has no False Negatives but allows a rare False Positive.</p>