We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Prim's (MST) : Special Subtree
Prim's (MST) : Special Subtree
Sort by
recency
|
151 Discussions
|
Please Login in order to post a comment
python3
Here is my solution in java, javascript, python, C, C++, Csharp HackerRank Prim’s (MST) : Special Subtree
This code works fine for all the cases on my machine, but fails on the last 2 cases with RunTime Error, but I got the expected output on my machine.
For those who are using a priority queue (or any array of fixed size) with adjancency list, and are getting segmentation error on test 5 and 6, try changing the bounds to n(n - 1)/2 + 1. In the test cases the size of priority queue exceeds the number of edges.