Блог пользователя DCSekhara

Автор DCSekhara, история, 5 лет назад, По-английски

Recently I came across this blog Efficient and Easy segment trees. After reading this I felt that the normal implementation with 5 arguments is easier to understand and implement(in my opinion). I want to know which of the implementations of segment-tree is better so that if the one written in the blog is better I will try to learn it. (better in the sense that it can be easily be applied in some new question)

  • Проголосовать: нравится
  • -19
  • Проголосовать: не нравится

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by DCSekhara (previous revision, new revision, compare).

»
5 лет назад, # |
Rev. 3   Проголосовать: нравится +3 Проголосовать: не нравится

There isn't a "perfect" implementation of a Segment Tree. It's all based on what you prefer and are comfortable with. I prefer recursive Segment Trees over iterative because while iterative Segment Trees are shorter to code, recursive ones are easier to understand and modify at least for me.
If I was looking for an implementation I could easily modify and adapt to solve new different questions, personally I would use the recursive implementation.

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    thanks. I too personally feel the same. But since the blog is written by a red-coder I doubted myself