It's UWAweek 47

help2200

This forum is provided to promote discussion amongst students enrolled in CITS2200 Data Structures and Algorithms.

Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

How do I ask a good question?
Displaying selected article
Showing 1 of 176 articles.
Currently 12 other people reading this forum.


 UWA week 18 (1st semester, week 9) ↓
SVG not supported

Login to reply

👍x1
helpful
8:43pm Thu 2nd May, ANONYMOUS

Hi, my code kept failing the get_cousin_dist() part. it is passing the tests until (B, D).

From what i understood, to find the degree value of 2 individuals, I have to find the generation distance between their common ancestor and the originator. For example: the pair D and E they have the common ancestor B, and the generation distance between B and Originator A is 0. So the degree value is 0.

And if their common ancestor is the Originator itself, then take the larger distance as the degree. For example: the pair B and F the generation distance from B to A is 0, and the distance from F to A is 1, so the degree value is 1.

But for the pair B and D, B itself is the ancestor of D, the pair's expected degree value is 0. Clearly the "B to A is 0, D to A is 1, so take 1" method isn't working here. So I thought, then B itself would be their common ancestor? B to A is 0, and the expected value is 0, it seems to be working.

But then there's the pair B and J, their expected degree value is 1. B is also the ancestor of J. B to A is 0, J to A is 2, but the expected value isn't 2. And going with b is the common ancestor, the expected value isn't 0 either.

So I am genuinely confused on why the expected degree value of (B, D) is 0, and for (B, J) is 1.

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  8:08AM Aug 25 2024
Privacy policy