Beta
Cousin marriage: path analysis
Loading description...
Graph Theory
Trees
Recursion
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.
Great kata authoring work once again. I can't imagine the time you must have spent on this kata.
Thanks for beta testing it again! (Almost a week.)
Almost a week, damn! I wonder whether I should have a go at a JS translation. (I also wonder why other solutions remain out on the other kata. I hope it gets approved soon.)
You may want to change the terms you use.
This way, you can also remove the "this is not correct" part of the common ancestor in case one is a predecessor of the other, since an ancestor can include self
I changed the first sentence of the rules to
An ancestor of a person is either themself or any direct ascendant of that person
. I also removed the sentence about the common ancestor when going down from an ancestor to some of their descendant.When I was doing my research, I found that there are other things to take account of when computing the coancestry of two persons for some specific cases (for example when they are ancestor-descendant in one way and cousins in another way). The note is there to inform the user that the formula is not exact for some cases. Maybe I should rephrase it.
in this kata: a person has either both a mother and a father, or neither a father nor a mother
I accommodated the tests to the new definition: there's now one path between someone and themself.
Why did you mention "on the path p" here? Is the path a parameter on the coefficient of inbreeding?
No, but each path can have a different common ancestor. I see your point, I will think of way to make it clearer.
Edit: I changed the formula to
Where cp is the common ancestor of a and b on the path p.
ok next thing that is unclear: sometimes your paths (in expected feedback) are from source to destination, and sometimes the other way around, why is this?
make sure to sort your paths from src to dest, not by some default python sort
I was, exactly five seconds ago, going to add a note about that. The direction of a path is not important. The path
1 → 2 → 3
is the same than the path3 → 2 → 1
. That's why I chose to show paths in different directions in the sample tests.Ok I pass the kata now, except for a timeout. Are there considerable performance constraints? I mean, is caching required or something?
I don't think so. I usually pass the tests between 4 to 6 seconds. Sometimes, rarely, it takes 8 or 9 seconds. If you think that the tests are too unbalanced, I can shrink some of them.
nah, I'm probably using a horrible CA finder algorithm. EDIT: indeed, my algorithm was ***
Not sure this is in the descripton already in some form, but I would add a note:
That wasn't present. I added a subsection about the family at the beginning of the rules where I put that information.
I was thinking about a new kata in the series, families on Mars, where each person has 2 fathers and a mother. Calculate the coefficients ... :)
Let's go to Mars! ^^