Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
A union/find data structure is a data structure used for maintaining a partition of a set.
3
votes
C++ two-phase path-compression quick-union union find over indices
Honestly, it seems cumbersome.
First, using a std::size_t instead of a std::optional<std::size_t>, and making the roots their own parent, would half the needed memory.
Next, throwing away the addition …
4
votes
Union-Find in C++
Welcome to Code Review.
union_find.cpp looks like a header-only library. It's thus strange its not named like a header.
Make all single-argument-constructors explicit unless you really want to see t …
2
votes
Disjoint-set data structure (C++)
High-level design:
All the other answers went over the minutiae quite sufficiently, but this is where about 66% savings are easily achieved.
There are some questionable design-decisions, which complic …