2 ms·
No, I'm generating a tree. Put every node in its own component. Find the shortest edge that joins two components, emit that edge, merge the components. Lather
by RiderOfGiraffes 16y ago
No, I'm generating a tree.
Put every node in its own component. Find the shortest edge that joins two components, emit that edge, merge the components. Lather, Rinse, Repeat.
Also, braces penalise you twice. Code that is identical except that one includes, the other excludes, a pair of braces are distance 2 apart. There is some reason to say they should have distance 0. Fully parenthesised code, and then ignore the close (or open) brace would fix that.