https://github.com/brahle/algorithms
Algorithms
https://github.com/brahle/algorithms
Last synced: 3 months ago
JSON representation
Algorithms
- Host: GitHub
- URL: https://github.com/brahle/algorithms
- Owner: brahle
- License: bsd-2-clause
- Created: 2015-07-13T00:01:30.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-08-06T00:27:10.000Z (almost 10 years ago)
- Last Synced: 2025-01-13T21:34:25.895Z (5 months ago)
- Language: C++
- Size: 141 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Algorithms
Implementations of certain algorithms and data structures.
## Authors
Bruno Rahle
## Queue with Random Access
### Creation
To get you started, you can use something like this
```lang=cpp
#includetemplate
using Queue =
data_structures::
queue::
RandomAccessQueue ;using UIntQueue = Queue ;
UIntQueue Q;
```### Operations
* `void push(T x)` - adds the element to the queue
* `T pop()` - returns the front element from the queue and removes it
* `T front()` - returns the front element from the queue
* `const T& operator[](size_t i) const` - returns the i-th element from the queue, const version
* `T& operator[]` - returns the i-th element from the queueAll operations are O(1) time, and it uses O(N) memory.
### Testing
Run `make src\-C src\data_structures\queue\__tests__` or `make -C src\data_structures\queue\__tests__ random_access_queue_debug`