An open API service indexing awesome lists of open source software.

https://github.com/brahle/algorithms

Algorithms
https://github.com/brahle/algorithms

Last synced: 3 months ago
JSON representation

Algorithms

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
#include

template
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 queue

All 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`