Convex hull of backtracking operation

Meaning of the questions: a tree, point to ask each ancestor node v To in of c[v]c[u]/dis(v,u) of m i n value.

The third question exam yesterday, is already seen on the convex hull maintenance, but for dfs Back when the convex hull of how to maintain the violence will only get stack maintenance (but it seems that for the time complexity of random data O(nlo g2n )), However positive solution approach is to use a persistent stack.

In fact, the persistence stack is a tree, back to back operation is equivalent to the ancestors, while adding a new node in , Following a directly connected state of the node, and then multiplying the direct-half (new position), to find the optimal node v , And can persist in the stack in To v The section of the path, in fact, the addition of normal in The need to pop those elements of the stack, so that you can directly multiply-half to find the optimal solution, directly connected to that point below.

Multiplying two points:
sweep from high to binary status, the node compares the current optimal multiplication node in versus in Father v Who better, if v Better, remains unchanged binary (this period because he could still be the optimal solution), then assign it as the optimal node v Otherwise, it is a bit lower, continue to in Doubled.

Published 51 original articles · won praise 6 · views 20000 +

Guess you like

Origin blog.csdn.net/qq_35776579/article/details/78168303
Recommended