Implementing specialized data structures in modern C ++
(Ok, so my previous question is suspended as too broad, so I'm narrowing it down here.)
I want to enter algorithmic programming contests, and a lot of the problems depend on using specialized data structures that are very good at a certain operation - for example, Fenwick trees allow calculating the prefix sums of a list of values ββin logarithmic time.
What is the preferred way to implement such data structures in modern C ++ (i.e. using C ++ 11 features)? Is it possible to use STL algorithms and containers instead of struct
manually writing and coding each operation?
I'm looking for Fenwick trees, segment trees, treaps, and some other data structures often useful in IOI-style contests, but general strategies are more than enough.
source to share
there is a fenwick tree implementation here: http://www.algorithmist.com/index.php/Fenwick_tree
It uses std :: vector as its base container. perhaps the method increase
can be written in terms of std::transform
or std::foreach
.
source to share