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

Автор tehqin, история, 9 лет назад, По-английски
  • Проголосовать: нравится
  • +54
  • Проголосовать: не нравится

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

Hello, firstly thanks for the awesome episode.

I had a query. Can you tell me if the following is correct which I've understood from this episode ?

Dominator tree can be constructed using LCA. To do that, we first topologically sort the nodes in the DAG. Then we process them sequentially. While processing a node, we find out the LCA of the set of nodes who have a direct edge to the current node. Then we can safely say that this LCA is the immediate dominator of the current node. So we simply add the current node as a child of the LCA we've found in the dominator tree and add the sparse table row for the current node in O(logn). Thus we can construct the whole tree.

I think the time complexity would be O(ElogV) as we are finding out LCA once for every edge.

Are the idea I described above and the time complexity analysis correct ?