Just another homework project.
This one provides an implementation of a data structure, that, given an array of N elements, can do the following in O(log n):
- Find the sum of all elements on a segment [l..r]
- Insert element x on position i
- Erase element on position i
- Assign the value of x to all elements on a segment [l..r]
- Add the value of x to all elements on a segment [l..r]
- Perform next_permutation on a segment [l..r]
- Perform prev_permutation on a segment [l..r]
Create project file with cmake and then build it with your favorite build system.
You can build the whole project with tests or just the library (the data_structure target).
MOST LIKELY YOU'LL HAVE TO REBUILD GOOGLE TEST FOR YOUR SYSTEM AND EDIT CMakeLists.txt TO MATCH NEW FILES