Sort 157 Discussions, By:
Please Login in order to post a comment
I only copy pasted code from the previous Prims algorithm problem and it worked flawlessly.
Please improve the problem. For example by printing order of selection of edges, instead of just the weight of the MST
Failing problem #6?
I paid for the input for problem 6, and the input says n=1000, m=10000.
However, there are only 6214 lines of input. Has the file been corrupted somehow?
Anybody else having problems with this?
Prim's algorithm passes all the test caes.
For those who fail on 5th test. I was using
to make two disjoing gragh, grouped. But the if statement which I was using was wrong, because "vis[y]" may be changed, but the other nodes of the "Y" disjoint graph will stay same. So when I changed if statement to
it worked. Hope it will help! ;)
no real reason to add weight in "u + wt + v" when weight is the same for the edges you choose from right?