Projects / treap.py

treap.py

treap.py is a treap implementation for Python. A treap is a hybrid of a binary tree and a binary heap that is self-balancing and is O(nlog2(n)) for most operations, including deleting a value, inserting a value, finding the least value, and finding the greatest value. This particular treap implementation looks like a dictionary to the caller, but it also supports getting an ordered list (forward or reverse) in O(n) time. The code is available as pure Python (should run on about any Python implementation supporting generators, but was tested on CPython 2.6) or as part Python and part Cython for performance. The version with Cython should run on CPython or Unladen Swallow, but was only tested on CPython 2.6.

Tags
Licenses
Operating Systems
Implementation
Screenshot

Project Spotlight

OpenStack4j

A Fluent OpenStack client API for Java.

Screenshot

Project Spotlight

TurnKey TWiki Appliance

A TWiki appliance that is easy to use and lightweight.