When submitting a solution in C++, please select either C++14 (GCC 6-32) or C++17 (GCC 7-32) as your compiler. ×

Shadi_Bahaa's blog

By Shadi_Bahaa, history, 22 months ago, In English

Hi!

I tried to solve this problem https://onlinejudge.org/external/106/10600.pdf?fbclid=IwAR2tGCAnxFqS61oAKAMBdN5qQ2zej1Ta1yjj8NN-teRJ8CeA3vNAOsws97U using Kruskal algorithm to find the two minimum spanning trees. The first MST is always correct. Although the logic of the second I implemented is the same, the second MST cost is not correct at all! Kindly Can someone tell me what is wrong with my code? This is my code: https://ideone.com/spXa9w

  • Vote: I like it
  • -1
  • Vote: I do not like it

| Write comment?
»
22 months ago, # |
  Vote: I like it 0 Vote: I do not like it

can you share your approach to how you find the second-best MST?