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

vec: minimal occupancy rate #10

Open
jenspots opened this issue Apr 17, 2024 · 0 comments
Open

vec: minimal occupancy rate #10

jenspots opened this issue Apr 17, 2024 · 0 comments

Comments

@jenspots
Copy link
Owner

Currently, the vec implementation uses a bitvec to keep track of which elements are present/removed. By doing so, we can remove elements in constant time instead of $O(n)$.

However, we might want to consider having a minimal occupancy rate, such as 50%. When this threshold is no longer met, the elements could be shifted to the front. While this operation would be of linear time complexity, the amortised cost would still be $O(1)$.

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

No branches or pull requests

1 participant