Excuse me, but you can't say something is
weird only because it's different from the ones you use!!!
Explanation of variable names:
i, j, k, p, q are just loop counters or dummy variables;
tt : store the total length;
xc, yc : store the coordinates of the "nodes"
the use of other variables should be obvious...
I leave out the function declaration part because I'm pretty sure that it's correct. I deliberately cut it off to shorten your time to read my code (I've applied the sorting function in hundreds of other programs, and they proved that my sorting code is flawless...).
Comments are omitted, because most of the users here know Kruskal's algorithm quite well. But if you think they're useful, I'll try to add some...
P.S. Since I applied this MST code in some other occasions and got ACC (esp. 10147 Highways), the most possible error in my code is input/output I think. Is my
eof statement wrong? Or are there any other i/o bugs?