Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skyzh/data-structure-deque
A deque of O(sqrt n) complexity on access, insert and remove, with an optimization for O(log n) access based on fenwick tree.
https://github.com/skyzh/data-structure-deque
binary-indexed-tree cpp deque fenwick-tree
Last synced: 2 months ago
JSON representation
A deque of O(sqrt n) complexity on access, insert and remove, with an optimization for O(log n) access based on fenwick tree.
- Host: GitHub
- URL: https://github.com/skyzh/data-structure-deque
- Owner: skyzh
- License: mit
- Created: 2020-02-17T06:05:24.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-17T06:25:54.000Z (almost 5 years ago)
- Last Synced: 2024-08-01T19:43:05.599Z (4 months ago)
- Topics: binary-indexed-tree, cpp, deque, fenwick-tree
- Language: C++
- Homepage: https://gist.github.com/skyzh/2597b532ad191036ae4a6dc785859e5b
- Size: 27.3 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-cs - @skyzh, 2019 Spring
README
# data-structure-deque
A deque of O(sqrt(n)) complexity on access, insert and remove, with an optimization for O(logn) access based on fenwick tree.
You may found the optimized version [here](https://github.com/skyzh/data-structure-deque/blob/master/deque_fenwick_tree_vector.hpp).
This one is four times faster than [Sqrt Vector](https://github.com/skyzh/data-structure-deque/blob/master/deque_sqrt_vector.cpp)
version on large data.This repo is migrated from my [GitHub gist](https://gist.github.com/skyzh/2597b532ad191036ae4a6dc785859e5b).
## Failed Attempts and Other Implementations
* [Linked List](https://github.com/skyzh/data-structure-deque/blob/master/deque_linkedlist.cpp): O(n) access, O(1) insert & remove
* [Ring Buffer](https://github.com/skyzh/data-structure-deque/blob/master/deque_ring_buffer.cpp): O(1) access, O(n) insert & remove (Like the one bundled with GNU C++ STL)
* [Sqrt Vector](https://github.com/skyzh/data-structure-deque/blob/master/deque_sqrt_vector.cpp): O(sqrt(n)) access, O(sqrt(n)) insert & remove
* [Chunk Vector](https://github.com/skyzh/data-structure-deque/blob/master/deque_vector_chunk.cpp): O(n/chunk_size) access, O(n) insert & move## Related Works
Another data-structure project I've done is a [B+ Tree](https://github.com/skyzh/BPlusTree) built from scratch.
This B+ tree supports on-disk persistence, on-demand paging and LRU. I've written several unit tests for it.