kactl icon indicating copy to clipboard operation
kactl copied to clipboard

Beginner-friendliness of Lazy Segment Tree

Open BarrensZeppelin opened this issue 2 years ago • 0 comments

Compared to the Lazy Segment Tree, the Segment Tree template is very beginner friendly. The three lines you have to change to alter the behaviour of the tree are adjacent, and you don't have to understand the rest of the code to make those changes.

The Lazy Segment Tree template does not have this nice property. Making that tree compute e.g. sums instead of maximums requires tricky changes in multiple places. If you know how these trees work you might be able to do it, but otherwise it's basically impossible. It's probably not possible to make it as nice to modify the behaviour as it is in the ordinary Segment Tree, but a little help can go a long way. :slightly_smiling_face:

I don't have a concrete idea for how to improve it (which is why I'm submitting an issue instead of a pull request), but maybe we can discuss. I know that beginner-friendliness is not a primary goal of kactl, but it may be possible to improve it without sacrificing the other goals.

BarrensZeppelin avatar Nov 10 '22 20:11 BarrensZeppelin