Implementations C++ #include <cstddef> #include <memory> template <typename T> class ArrayDeque { private: std::allocator<T> alloc_; T *array_ = nullptr; std::size_t start_ = 0; // WARN: end_ is not needed and you CANNOT do it without a size_ // end can be computed from size ...
Implementations C++ // for the single array holds size and par trick // you need a signed int as the array elem type // since the par too must be same as the elem type // you need int as type // templating here is kind of wasteful #include <vector> class DSU { private: std::vector<int> p...
Implementations C++ #include <concepts> #include <cstddef> #include <vector> template <typename T> concept Group = requires(T a, T b) { // INFO: you need to use other std::concepts in rhs here // so can't do std::is_same_v, need std::is_same_as // alternative is to add a...
Implementations C++ #include <cstddef> #include <vector> template <typename T, typename Cmp = std::less<T>> class Heap { private: std::vector<T> array_; Cmp comp_; // INFO: you don't need a size // INFO: it's complete b tree in the sense that you FILL the // r...
Implementations C++ #include <cstddef> template <typename T> class LinkedList { private: // INFO: only C needs struct Node like creation, in cpp can just do Node // so you never need that typedef thing struct Node { Node *next; Node *prev; T value; // copy ctors on T expected, fails othe...
general ideas for what I notice and feel while solving a problem the solution is not the code, implementation is not the challenge here ( well not at this stage ).