Segmentation fault
@pranaynigam there are 2 issues in your code
- you have to run kruskal outside the for loop in which you are taking the input
- int w=edges[0]
int x=edges[1]
int y =edgse[2]
it should be like this instead of this you are writing like
int w=edges[1]
int x=edges[2]
int y=edges[3]
which will give segment fault becuse vector size if 3 and your are accessing 4th element in y
Coding Blocks IDE
this is the changed code it will work fine and if your issue still exists let me know and if clear please rate my experience
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.