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 the 3 articles in this topic
Showing 3 of 176 articles.
Currently 7 other people reading this forum.


 UWA week 19 (1st semester, week 10) ↓
SVG not supported

Login to reply

👍x1
helpful
9:53am Tue 7th May, Lewei X.

Array-based representation of binary trees - Nodes are stored in an array A - Node v is stored at A[rank(v)] ○ rank(root) = 1 ○ if node is the left child or parent(node), rank(node) = 2 * rank(parent(node)) if node is the right child of the parent(node), rank(node) = 2 * rank(parent(node)) + 1 If this is the case, the both b and c (its labelled d but its the 3rd option) are valid representations. I have drawn out the binary trees below.



This article has 1 attachment:

 

SVG not supported

Login to reply

👍?
helpful
10:33pm Wed 8th May, ANONYMOUS

Hi! Not sure if you still need this, but the reason why (d) (or (c) in the updated version) is the answer is because it follows the same order as the tree in Q4 (all nodes and subtrees are consistent as the one in Q4). Whereas for (b), the tree is different since the tree has 24 and 34 as children of 13, which was not the case in the tree for question 4. Hope this makes sense :)


SVG not supported

Login to reply

👍?
helpful
11:09am Thu 9th May, ANONYMOUS

is the 13 supposed to not be in the answer? or is it another typo?

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