Skip to content

Conversation

@nonme
Copy link

@nonme nonme commented Oct 5, 2018

Description

Implementation of Kruskal algorithm with DSU in O(MlogN);

Related Issue

Please link to the issue here:
#236

How Has This Been Tested? (Optional)

Default test in main();

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (change which fixes an issue with the algorithm)

  • [x ] New Algorithm (non-breaking change which adds functionality)

  • Documentation

Checklist:

Go over all the following points, and put an x in all the boxes that apply.

If you're unsure about any of these, don't hesitate to ask. We're here to help!

  • [x ] My code follows the code style of this project.

  • My change requires a change to the documentation.

  • I have updated the documentation accordingly.

  • [ x] I have read the CONTRIBUTING document.

@GnikDroy GnikDroy added c++ Issue is specific to c++ hacktoberfest For issues and PRs done during hacktoberfest labels Oct 5, 2018
Copy link
Contributor

@GnikDroy GnikDroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you follow the directory structure Graphs/[Algorithm Name]/[Language]/[FileName]. Also make some minor changes to your code. Everything else seems fine.

This implementation is using DSU. O = M*log(N);
M - edges, N - nodes.
*/
//FUNCTIONS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this comment
We know that you are listing functions.
So you can remove //Functions.

return graph;
}

void find_mst(int n, std::vector<std::pair<int, std::pair<int, int> > > graph) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return the value that you want to be printed.
Don't make this function find as well as print the values.

dsu_unite(a, b);
}
}
print_result(weight, &mst);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take this function call and place it in main()

@nonme
Copy link
Author

nonme commented Oct 5, 2018

@GnikDroy thanks for your reply, il'l work on it

@tstreamDOTh
Copy link
Member

are you still working on it?

@nonme
Copy link
Author

nonme commented Oct 8, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issue is specific to c++ hacktoberfest For issues and PRs done during hacktoberfest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants