Closed George-Ogden closed 3 years ago
That's a good idea. For now, you can take a look at the tests to see sample usages.
For what it's worth, this repo's code errs on the side of code that is generic/zero-cost over easy-to-use, so a lot of the interfaces are somewhat esoteric. If you're looking for simpler-to-use code, a lot of other code books are more straightforward and accessible.
Is there some file in particular you're curious about?
The one that I looked at was the segment tree, as that's a fundamental data structure, and I couldn't make any sense of it.
The segment tree is the most esoteric interface in an effort to be extremely generic, and definitely requires a pretty strong knowledge of segment trees to use. Unlike many other segment tree templates, which manage an array of data for you, my template manages indices of a complete binary tree stored in the preorder layout, and you have to manage the data yourself. The fundamental ideas are that we decompose any range into O(log n) nodes of the tree, and you can use pass a callback to many iterator methods to iterate over that subset or their parents.
I see - but do you still think you could give an example of it being used for a problem, please?
You can check out https://codeforces.com/contest/1439/submission/98717653.
That's great, thanks
Can you give a quick explanation on how range::for_each_l_to_r
and range::for_each_r_to_l
work? Thanks.
This is a great repo, but I'm not sure how to use it. Do you think you could add some examples or explanations on how to use the code, please?