6 kyu
Prüfer sequences and labeled trees
Loading description...
Algorithms
Mathematics
Graphs
Graph Theory
Trees
Combinatorics
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.
Very nice.
Scala translation
Am I mistaken or should
a dict of dict
bea dict of set
?Yes, my bad, you are right - originally there was some additional information in there but now it's just a
set
.Updated everywhere in the description. Thanks for reviewing and solving @dfhwze !
It was surprisingly easy to solve, but I think that's due to the very clear specification and examples used.
Thanks - well I think you may also be under-estimating your power level just a bit ;)
But yes, it's a nice little "algorithmic" part of combinatorics; my hope is that the solvers feel rewarded after working through and thinking about the pseudocode in both directions.
It also provides a way to generate random trees, which might be useful for some people's toolkit.
Thanks again for solving - I like your
link
helper function, very clean!approved at kyu 6
There's an implicit assumption that
n > 1
throughout the kata that's not specified anywhere. (n = 1
andn = 0
has 1 unique labeled tree too)Hi @Voile - thanks, as always, for solving and for the feedback.
Good point - I've now made it explicit that tests will always have:
n >= 3
vertices, in tree -> PS tests.l >= 1
, in PS -> tree tests.