Is the Union-Find (or Disjoint Set) data structure in STL?

Ritwik Biswas picture Ritwik Biswas · Apr 22, 2017 · Viewed 10.7k times · Source

I would have expected such a useful data structure to be included in the C++ Standard Library but I can't seem to find it.

Answer

Nir Friedman picture Nir Friedman · Apr 22, 2017

It is not, but there is one in boost: http://www.boost.org/doc/libs/1_64_0/libs/disjoint_sets/disjoint_sets.html, so if you want an off-the-shelf implementation I'd recommend this.