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.
Breadth First Search: Shortest Reach
Breadth First Search: Shortest Reach
Sort by
recency
|
681 Discussions
|
Please Login in order to post a comment
Test Case 1 is wrong: the distance to node 6 is expected to be 6 but in the test case data there is no edge 16->6, interestingly there seems to be 2 16->69 edges in the input, not sure if that was intentional.
Javascript
Test case #6 is failing in some inscrutable way.
Test case 6 is so huge, that even if I diff the expected from the actual result (after adding newlines so diff will show something useful), I can't tell what's wrong. I'm guessing I'm picking the wrong node to look at next, I'm just using a plain queue.
Dijkstra's Algorithm says to take the shortest-distance item from the queue of nodes to visit next, but how exactly am I supposed to do that inexpensively without
@datastructures-js/priority-queue
?Diff where
-
is my output and+
is expected.Also, this text editor is really buggy, now I'm typing blind because it's off the bottom of the text area.
Python3 solution, what do you guys think?