scratch

§ Path Query to Subtree Query

created 2022-01-28
  • Model question: CSES counting paths
  • We have a static tree, and we wish to perform updates on paths, and a final query.
  • We can uniquely represent a path in a tree with an initial and final node. There are O(n2)O(n^2)O(n2) paths in a tree, so we need to be "smart" when we try to perform path updates.
❦
Newer ৪ Blog ৪ Older