Programming Methods & Algorithms Python scripts - Top 4 Download

Programming Methods & Algorithms Python script downloads

Convex hull and diameter of 2d point sets

This script returns the convex hull (separated into upper and lower chains of vertices) and the diameter (farthest pair of points), given input consisting of a list of 2d points represented as pairs (x,y). The convex hull algorithm is Graham's scan, using a coordinate-based sorted order rather than the more commonly ...
Python

Infix Postfix

This script is useful to convert an infix expression to postfix and vice-versa. You can also evaluate infix and postfix expressions. ...
Python

Memoize Decorator with Timeout

This simple decorator is different to other memoize decorators in that it will only cache results for a period of time. It also provides a simple method of cleaning the cache of old entries via the .collect method. This will help prevent excessive or needless memory consumption. ...
Python

Storage for store information about prefixes

Storage for store information about prefixes script allows you to store information about domains determined by key prefixes. ...
Python

Summary reports using itertools groupby

This script produces a summary of the data, grouped by the given key (default: the first item), and giving totals of the given value (default: the second item). The key and value arguments should be functions which, given a data record, return the relevant value. ...
Python

Two pass Pairing Heap with Auxiliary List

This script allows you to manage data collections.For random data, this implementation still makes more comparisons than a sort using heapq or the builtin sort. For partially ordered data, it can perform better than the builtin sort. Because of the list of lists data structure, it always takes more memory than ...
Python

Type checked argument lists with decorators

This script shows you to use the new decorator feature of python 2.4 to systematically check the argument types for type-sensitive functions. ...
Python

Criteria based cascading priority queue

This module provides a simple criteria-based priority queue with "priority cascading".The criteria argument should be a sequence of callables that return boolean values. There is no need to add an "all pass" criterion at the end; the queue will add all non-matching items with the least priority.ill add >a ...
Python

Find the most frequent elements

This script returns a sorted list of the most common to least common elements and their counts. If n is specified, return only the n most common elements. ...
Python

More accurate sum

Built-in "sum" function, as well as add.reduce functions in Numeric/numarray introduce a large error when summing large arrays of like elements. This script contains a function that makes sums with error less than 1e-15. It doesn't use any additional memory (although it destroys the data array), and also runs asymptotically faster for unlimited precision ...
Python

Binary floating point summation

This script eliminates completely  rounding errors and loss of significance due to catastrophic cancellation during summation. It  achieves exactness by keeping full precision intermediate subtotals. Offers three alternative approaches, each using a different technique to store exact subtotals. ach >using/ ...
Python

Rabin Miller probabilistic prime test

In this script is included a method for performing the Rabin-Miller probabilistic test for a composite witness.  Rabin-Miller test can only tell us if a value is definitely composite. In the case where a test value is not a witness for the compositeness of a potential prime, it can only lie with a probability ...
Python

Padding variable length sequences

Padding variable length sequences script returns a pad function that implements tuple unpacking. ...
Python

Buffered Stream with Multiple Forward Only Readers

This script provides a buffered stream that supports multiple forward-only readers. The buffer enables readers that are behind the front-runner to access values that have already been read from the stream. Values that are no longer accessible by any reader are cleared from the buffer. ...
Python

Pseudo random string to float conversion

Pseudo-random string to float conversion script converts strings to floats in the range [0, 1), using a hash function. ...
Python

Timeit module wrapper

This script contains a simple, easy to use wrapper function for doing quick tests of your functions using the timeit module.The timeit module provides an easy way of testing the performance of your Python code by running it in many iterations and averaging the timings. However it is not very obvious how ...
Python

Scramble Word

Scramble word script re-arrange characters of word by using simple string manipulation and Random module. ...
Python

Arithmetic coder

Arithmetic coder script is a simple but slow way of compression using arithmetic coding. ...
Python

Encoding A String

The main purpose of these functions are to allow encoding a string from base 256 to a special base 255. The function view the strings as numbers and simply change what base they are written in. This is not recommended for very long strings; otherwise, the encoding and decoding process can ...
Python

Merging sorted iterables

This script helps you to merge sorted iterables, preserving ordering,without consuming iterables (and computing time) unnecessarily. ...
Python