Sentence Similarity II


  • 0

    Click here to see the full article post


  • 0
    W

    I think the time complexity for the union-find not by rank method is not right. the first loop to construct dsu calls union O(P) times and union runs in O(logP) time because it called find. So the overall should be O( (N+P)log P )?


  • 0
    I

    I think the time complexity of DFS method is not right
    The time complexity of DFS is O(|V| + |E|), and here, |V| = N, and |E| = P. The DFS is executed "N" times, so then shouldn't the time complexity be O(N(N + P)) ?


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.