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

Автор Jajceslav, 6 месяцев назад, перевод, По-английски

Centroid Decomposition is kinda like Divide & Conquer on arrays (merge sort type divide&connquer) but for trees. Ever thought about it that way? Like HLD is a segment tree but for trees, what do you think? nvm just had a fun thought yesterday, never looked at it from this angle, cool (i attached some imagery)

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

»
6 месяцев назад, # |
  Проголосовать: нравится +84 Проголосовать: не нравится

There is more to say, but to begin with. When you need to solve problem on a tree, try solving it on array and then extend your methods to trees. You just showed examples of those extensions, which I use when facing tough problem sometimes.

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

    True! Very common trick to solve tree probems, esp. query related, trees are dope

»
6 месяцев назад, # |
  Проголосовать: нравится +43 Проголосовать: не нравится

If I am not wrong then we also have: Fenwick Tree for Arrays = Binary Lifting for Trees

»
6 месяцев назад, # |
  Проголосовать: нравится +164 Проголосовать: не нравится

BITSET is kinda like BITSET on arrays but for trees

»
6 месяцев назад, # |
  Проголосовать: нравится +32 Проголосовать: не нравится

Similarly, segment tree is persistent divide and conquer on an array.

  • »
    »
    6 месяцев назад, # ^ |
      Проголосовать: нравится +69 Проголосовать: не нравится

    Similarly, persistent segment tree is persistent persistent divide and conquer on an array.

    • »
      »
      »
      6 месяцев назад, # ^ |
        Проголосовать: нравится +9 Проголосовать: не нравится

      Similarly, persistent n-dimensional (range sum) segment tree is (persistent divide and conquer on) $$$^{n-1}$$$ persistent persistent divide and conquer on an array.

      Spoiler
»
6 месяцев назад, # |
  Проголосовать: нравится +56 Проголосовать: не нравится

"Binary Search Tree" is literally "binary search on array, but you store the entire recursion tree".

"Segment tree" is literally "divide and conquer, but you store the entire recursion history".

I wish people teach these kinds of things in classes. This is the definition of knowledge = connect the dots on information.

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

Koreans called this "divide and conquer on tree", before the word centroid decomposition became popular.