Hello sir/ma’am,
my code for this problem is not showing any output. I am unable to find the mistake. Please help me debug this. sharing my code:
Kruskal's Algorithm
Hello @Akshita99,
Problem in your code:
edges.resize(m);
This will allocate m locations to vector edges.
But when you’ll execute the following statement:
edges.push_back(make_pair(make_pair(x,y),w));
push_back will insert after 15 locations.
This is causing wrong answer.
Solution:
Remove the following statement:
edges.resize(m);
Corrected code:
Hope, this would help.
Okay. Got it!!! Thank you so much sir!!