That sounds like half a good answer to me. I'd have to complain that you are using the variable 'sets' without initializing it, however. ;) In other words, what does the value of 'sets' start at?
|Sets starts at N. Where N is the number of items to connect. For every union operation, the number of sets decreases by 1.|
int itemsToConnect = 10;
int itemSets = itemsToConnect;
if( union( 3, 4) ) // ints are two "items" to connect
Is that better or worse? Heh.
Last edited on