Skip to main content

py-fast-trie

Python Versions Package Version

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.

Usage

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

License

py-hopscotch-dict is released under version 3.0.0 of the Prosperity Public License

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_fast_trie-2.2.0.tar.gz (19.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_fast_trie-2.2.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file py_fast_trie-2.2.0.tar.gz.

File metadata

  • Download URL: py_fast_trie-2.2.0.tar.gz
  • Upload date:
  • Size: 19.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for py_fast_trie-2.2.0.tar.gz
Algorithm Hash digest
SHA256 69554c047072eb29e391e712e172aad1bbf5e63bce270524823317dbae0d6136
MD5 eceab5015d1ad2335a518d60fd2cc31f
BLAKE2b-256 a554f28c00c604cc4ed1ee17acb03a1ee4446d4d32fc6ab3d269282f0ee4ab67

See more details on using hashes here.

File details

Details for the file py_fast_trie-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: py_fast_trie-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for py_fast_trie-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eedaf1f7002c81e0e421251315905528a9af61461177e92d719719d34afaae41
MD5 06a12ae8d30f956dbd028d9f9d94cfae
BLAKE2b-256 7bc560e632331493791d481623801453eb3494b11b0dca9dc0309be3468116e3

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.2.0 This release

2 files

2.1.2

2 files

2.1.1

2 files

2.1.0

2 files

2.0.1

2 files

2.0.0

2 files

1.0.1

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page