It's UWAweek 20 (1st semester, week 11)

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 123 articles.
Currently no other people reading this forum.


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

Login to reply

👍x1
helpful
12:38am Fri 3rd May, Diarmuid OC.

Hi, not a facilitator, but I think I can help.

You seem quite close with what you've got, but I think the problem is that you don't need to consider the Originator as something separate, the same constant rules will always apply.

As we know, the generation distance (or order) of two individuals is the number or generations that separate them, which you seem to be doing right.

To calculate the degree between two individuals, we need to consider the order of both individuals against their closest shared ancestor. So taking the example of the pair B and D, which is expected to return a degree of 0, we start by finding their closest ancestor, which is B. Then we calculate the order of each of the individuals in the pair compared to the single shared ancestor.

So starting with D (because it's simpler), we compare it against the shared ancestor B, and we get an order of 0. Then we do the same thing with the second individual in the pair, B, comparing it against the shared ancestor B, which gives us a weird order value of -1 because it's the same individual.

The degree is the bigger one of these two orders, 0 and -1. 0 > -1, so the degree is 0.

We can do the same process for B and J. Their closest shared ancestor is (again) B. So starting with B this time: B to the shared ancestor of B gives us an order of -1. And for J: J to the shared ancestor of B gives us an order of 1.

Comparing these orders: 1 > -1, therefore the degree for the pair B and J is 1.

I'm pretty sure this is the right way to approach it, I hope this helps to explain it a bit better!

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