## Arc Algorithm scripts

#### Binary search in one line

This is an implementation of the binary search algorithm in (almost) one line. Given a number 'n' and a list 'L', the function returns the index of the number on the list, or -1. ...
Python

#### Rating class with mapping interface

Rating class with mapping interface script deals with items sorted by value and accessed by key or rating index. ...
Python

#### Turing Machine Simulator

Turing Machine Simulator allows an arbitrary machine to be loaded. Words (represented as strings) can be ran against the simulator producing a response: Accept or Crash. ...
Python

#### Implementation of sets using sorted lists

... element comparisons.Results are built using fast-slicing. - Algorithms are designed to minimize the number of compares which can be expensive. - Natural support for sets of sets. No special accomodation needs to be made to use a set or dict as a set member, but users need to ...
Python

#### High performance currying with instance method

This script implements the instance method for performing currying. Instance method provides a way to perform currying such that the curried function runs much faster than one produced by closure. Currying is an important technique to build callables on the fly and is well covered in other recipes. If the callables ...
Python

#### Convex hull and diameter of 2d point sets

... points represented as pairs (x,y). The convex hull algorithm is Graham's scan, using a coordinate-based sorted order ... commonly seen radial sorted order. A rotating calipers algorithm generates candidate pairs of vertices for the diameter calculation. Care was taken handling tricky cases such as pairs of points with the same x-coordinate ...
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

#### Rabin Miller probabilistic prime test

... prime) is at most 4**-k. Included is an algorithm for generating a number of b bits for which no composite witness was found after k trials. Removing mathematical rigor will suggest that the probability of the value being prime after k trials is at least 1-1/4**k. ...
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

#### 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