It's UWAweek 18 (1st semester, week 9)

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 99 articles.
Currently 1 other person reading this forum.


 UWA week 16 (1st semester, week 7) ↓
SVG not supported

Login to reply

👍?
helpful
10:21pm Wed 17th Apr, Nico B.

There is an explanation under the function in genealogy.py that explains how to calculate it. If you draw a diagram of the test sample genealogy, you can see who is related to who and find their closest shared ancestor. Then, from this shared ancestor, you count how many generations from the ancestor starting at 0. So child is 0, grandchild is 1, great-grandchild is 2, etc. Do this for both the relatives so you have the order for each of them. Then the degree is whichever of these is greater. So order 1 and 2 would be degree 2. The removal is the difference in the orders, so for order 1 and 2, removal is 1. If you go through the expected answers in the tests, you should find the result is the same as what you would expect. I am a bit confused for the ones where the shared ancestor is one of the "cousins", such as "B" and "D" or "B" and "J". It looks like if you make the shared ancestor order -1, then the child 0, etc, then "B" and "F" is order 1 (greater of -1 and 1) and removal is 2 (difference of -1 and 1 as an absolute value).

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  5:07AM Sep 06 2023
Privacy policy