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.
Indeed :p My solution uses a plain random-access array of set IDs. While inserting new set is O(1), merging is O(n), so worst case nears O(n^2) I think.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Components in a graph
You are viewing a single comment's thread. Return to all comments →
Indeed :p My solution uses a plain random-access array of set IDs. While inserting new set is O(1), merging is O(n), so worst case nears O(n^2) I think.