We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
We actually don`t need to use 2 arrays for union find (for parents and size) we can use one array, and let negative values mean size of tree (if current node is root), or parent node (if current node is not root)
Merging Communities
You are viewing a single comment's thread. Return to all comments →
We actually don`t need to use 2 arrays for union find (for parents and size) we can use one array, and let negative values mean size of tree (if current node is root), or parent node (if current node is not root)
My code in C++