Package for an indexable circular array data structure.
Project description
Python Circular Array Implementation
Best used as either a standalone improved Python list or in the implementing of other Python data structures.
- Python module implementing an indexable, double sided queue
- See grscheller.circular-array project on PyPI
- See Detailed API documentation on GH-Pages
- See Source code on GitHub
Overview
The CircularArray class implements an auto-resizing, indexable, double sided queue data structure. O(1) indexing and O(1) pushes and pops either end. Useful if used directly as an improved version of a Python List and in the implementation of other data structures in a "has-a" relationship.
Usage
from grscheller.circular_array.ca import CA
ca = CA(1, 2, 3, sentinel = None)
assert ca.popL() == 1
assert ca.popR() == 3
ca.pushR(42, 0)
assert repr(ca) == 'CA(2, 42, 0, sentinel = None)'
assert str(ca) == '(|2, 42, 0|)'
assert ca.popL() == 2
assert ca.popL() == 42
assert ca.popL() == 0
assert ca.popL() == None
ca0 = CA(1, 2, sentinel = 0)
assert ca0.popR() == 2
assert ca0.popR() == 1
assert ca0.popR() == 0
Project details
Release history Release notifications | RSS feed
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
Close
Hashes for grscheller_circular_array-3.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1bfd1a8ab1dbbaf0ecd2d925f290014b3b1cbce089699fc5e5445667f5d8fd7c |
|
MD5 | a3d5f5581324115e761478ad26394b72 |
|
BLAKE2b-256 | 86629e2c2c6c39b445d36ca48afec3e45cd5427a72c2994180e62b05b9b9e531 |
Close
Hashes for grscheller_circular_array-3.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8fcd9fbec34df214cfb6ac6350cffeb1e558d490e847a7d2b30c874298db621 |
|
MD5 | 882f1d5f370865090a0544263accb4c2 |
|
BLAKE2b-256 | 5a666ede8b61531ff999f4489dd8760e2581c0475084ebde35e06c6b27cdecf6 |