There is a graph with N vertices and two types of queries:↵
↵
1) connect U and V↵
↵
2) disconnect U and V↵
↵
After each query, the number of connected components should be printed. Is there a better solution that O(NQ)?
↵
1) connect U and V↵
↵
2) disconnect U and V↵
↵
After each query, the number of connected components should be printed. Is there a better solution that O(NQ)?




