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
Hashes for pyrangelist-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db3672506363f1c6842a471858813fd966816dbe02915987153141ef95f4616a |
|
MD5 | 002946c607975cb8510b4a146478d0c2 |
|
BLAKE2b-256 | 501c29fd6cad698fb8c00b32bf619042b7d24ff7b6ecdbaa3000ec41fe2271f1 |