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

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

Hello everyone! I am trying to solve the following problem:

You are given a DSU (Union Find) data structure, and you need to do the following queries efficiently:

  • Go back to time t, and insert a union operation (Union(u, v, t)) at time t.
  • Undo the union at time t.
  • Given time t, and two nodes u, v check if nodes u and v are in the same connected component at that time.

Any help or offline / online solution would be perfect!

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

»
4 недели назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Undoing operations online is quite hard. This is a solution to the online problem without undoing operations: Maintaing mst with onl8ne edge insertions You can use offline deletion trick on the above DS for your general problem. Hope it is still relevent

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

use a stack its called rollback dsu

this is oonline solution btw

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

DSU with rollbacks + splitting queries into blocks would work in some sqrt time complexity. You can see APIO 2019 Bridges for some similar solution.