
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
py-fast-trie is a package that contains pure-Python implementations of an X-fast Trie and a Y-fast trie, as described in the foundational paper.
The most notable benefit of X-fast and Y-fast tries compared to more common data structures such as binary search trees is that searches are log-logarithmic in the cardinality of the universe as opposed to being logarithmic in the number of elements in the structure itself; For reference if you needed to store 2^20 items with a potential maximum value of 2^32 - 1, finding a particular item would take 20 operations in a red/black or AVL tree, but only 5 with an X-fast or Y-fast trie.
The interfaces of the X-fast and Y-fast tries are identical, the Y-fast trie is used here as an example.
>>> from py_fast_trie import YFastTrie
>>> t = YFastTrie(max_length=32) # The library defaults to the machine's word size
>>> for i in range(10, 13):
... t += i # Value insertion/removal operations have intuitive
>>> t.min # shorthands
10
>>> t += b'\x0d' # The library can handle byte strings less than the
>>> t.max # max length by treating them as integers
13
>>> for val in t:
... print val
10
11
12
13
>>> t < 12 # Predecessor/successor queries have intuitive
11 # shorthands
>>> t > 0
10
t -= 13
>>> t > 12
>>>
FAQs
Python library for tries with different grades of fastness.
We found that py-fast-trie demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.