Beta
Are these nodes connected?
31SimplGy
Loading description...
Data Structures
Algorithms
Graph Theory
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Duplicate to at least 10 kata
@underscores This kata was published in 2016 while the one you link was published in 2017. You can't call a kata a duplicate if it was published before the others.
that doesn;t mean that we should allow this kata (note: we have already 10-15 this type of kata on CW so no more please)
ahh my bad i misunderstood:D
I added random tests to this kata, please refer to me if something is broken. If everything is fine i think this kata is valid for approval.
I puts these code to the example test block and it works, why I got error when I submit?
The full test suite tests a set of 10 nodes, with more complex connections, so you could pass for a simple 0,1,2 case but fail for something more tricky. Check your work!
new
is not necessary, and sometimes not desired. I did not buildNode
so that it requires thenew
operator.Marking as resolved since the author managed to solve the kata
Some more tests are neede (look at my solution !!) And a test example would be nice too
added some more tests
I think I have resolved the issue.
An example test case would be nice. There is a good example in the description, just copy that to the example tests. Could use some more tests for the submit including some random ones. What should it do about infinite loops? connect(1, 2); connect(2, 1); isConnected(1, 3); and other edge cases? The example shows 10 nodes being created and then it references node 0. Are the nodes zero based or does Node(10) mean the largest index is 10 (ie nodes 0->10)? Cool concept. Fun Kata. Thanks!
Yeah, I can definitely make this better. This is based on https://www.coursera.org/learn/introduction-to-algorithms/lecture/RZW72/quick-union-improvements, and I'd be happy to accept new test cases and contributions if you feel up to it.
I added a suite of tests that exactly matches the written example, and made the written example a little more robust.
awesome!