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

Doubly Resizable Arrays #2

Open
SWeini opened this issue Feb 27, 2021 · 0 comments
Open

Doubly Resizable Arrays #2

SWeini opened this issue Feb 27, 2021 · 0 comments
Labels
area: collections enhancement New feature or request

Comments

@SWeini
Copy link
Owner

SWeini commented Feb 27, 2021

http://erikdemaine.org/papers/ResizableArraysTR/
Implement the variant that can grow/shrink on both ends. The extra space is O(√n) at any point in time. Access by index is still O(1).

Comparison to standard libraries:
There is no real alternative.
System.Collections.Generic.List<T> can't grow/shrink on the front in O(1)
System.Collections.Generic.LinkedList<T> can be changed from both ends in O(1), but does not support indexed access and wastes O(n) space
System.Collections.Generic.SortedDictionary<int, T> has O(log(n)) indexed access and wastes O(n) space

@SWeini SWeini added enhancement New feature or request area: collections labels Feb 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: collections enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant