When submitting a solution in C++, please select either C++14 (GCC 6-32) or C++17 (GCC 7-32) as your compiler. ×

AbdoGad's blog

By AbdoGad, history, 10 months ago, In English

Hello I have a question if I have a tree with n nodes and all nodes have some value there are two types of queries

  1. what is the max node value in the path (u,v)

  2. update u to be equal to x

I think HLD can solve this problem but I want to know if there is other ways or techniques that can solve a problem like this

Thank you

edit:

Why does eveybody keep downvoting I just had a question

  • Vote: I like it
  • -18
  • Vote: I do not like it

»
10 months ago, # |
  Vote: I like it +1 Vote: I do not like it

You can also use link-cut trees, in my experience they are faster

»
10 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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