Implementation of the RangeList datastructure in python.
Project description
pyrangelist
Hello Jerry
This is my work for the take home interview. I'm not a JS guy. But if Jerry wants to take data science seriously, I will help you build the best infrastructure for it.
The package has 100% test coverage and has 10/10 pylint score, and it is stress-tested with 100k random add/remove operations.
Intstallation
pip install pyrangelist
Developer guide
Intall
python setup.py develop
As customary, pinned requirements are in the requirements.txt
.
Test
python -m pytest
About
This version uses intervaltree library under the hood.
A more efficient implementation would be a modified B-tree structure that would keep ranges as values,
as well as keep the minimum and maximum value of the subtree for each edge. This would allow deletion
and addition to be O(long(n) + m)
, where n
is the number of ranges currently stored and m
is the
number of ranges that the new range overlaps with. However, from the task description it didn't seem
like you guys were looking for maximum efficiency, so I focused my efforts elsewhere. The current implementation
is sub-optimal: O(long(n) * m)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyrangelist-0.1.2.tar.gz
.
File metadata
- Download URL: pyrangelist-0.1.2.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cd80753898302b7082a1eaa7d4edbef617fa7f6f92faa4130649c1ff8fd6eef |
|
MD5 | af71239355c08e0e6e1f035a3d81003c |
|
BLAKE2b-256 | 0983eb64d231b53870b79a78e6babf985d7a99eda565094d1900adc4afcf0568 |
File details
Details for the file pyrangelist-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: pyrangelist-0.1.2-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | db3672506363f1c6842a471858813fd966816dbe02915987153141ef95f4616a |
|
MD5 | 002946c607975cb8510b4a146478d0c2 |
|
BLAKE2b-256 | 501c29fd6cad698fb8c00b32bf619042b7d24ff7b6ecdbaa3000ec41fe2271f1 |