Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add SortedArray #183

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

bsamedi
Copy link

@bsamedi bsamedi commented Dec 24, 2021

Support for a sorted container based off the standard library array.array class.

Enables compact storage of numerical values saving times fold in memory required.

Time performance is en par with the List based implementation below 1M size, and marginally better at 10M and 100M size,
as tested on M1 Max 64GB RAM

SortedArray_load-add
SortedArray_load-bisect
SortedArray_load-contains
SortedArray_load-count
SortedArray_load-delitem
SortedArray_load-getitem
SortedArray_load-index
SortedArray_load-init
SortedArray_load-intervals
SortedArray_load-iter
SortedArray_load-multiset
SortedArray_load-neighbor
SortedArray_load-pop
SortedArray_load-priorityqueue
SortedArray_load-ranking
SortedArray_load-remove
SortedArray_load-update_large
SortedArray_load-update_small

@grantjenks
Copy link
Owner

It’s reasonable except for the lack of array.array.sort. Can you get support for that upstream? I haven’t searched bugs.python.org but it’s worth researching.

@bsamedi bsamedi changed the title add SoretedArray add SortedArray Dec 24, 2021
@bsamedi
Copy link
Author

bsamedi commented Dec 24, 2021

It’s reasonable except for the lack of array.array.sort. Can you get support for that upstream? I haven’t searched bugs.python.org but it’s worth researching.

Looks more like PEP rather than a bug to me. I found none. Is it a good one to request?

Before the array.sort() becomes a thing, we can try RADIX sort in pure Python, O(N) memory, O(N) time.
It even works for floats
What do you think?

fix docstrings

Co-authored-by: ilemhadri <19997801+ilemhadri@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants