Question: Question 1 is about a bounded binary tree implementation. You should remember binary trees from CMPT 1 4 5 ( or similar course ) they

Question 1 is about a bounded binary tree implementation. You should remember binary trees from
CMPT 145(or similar course) they are trees in which each node has at most two children. What you
probably didnt know is that binary trees can be stored using an array, rather than a linked structure. In
such an array, the contents of the root node are stored in offset 1 of the array (offset 0 is unused). The
contents of the children of the node whose contents are stored at offset i are stored at offset 2i and 2i +1,
respectively. Thus, the left child of the root is at offset 2\times 1=2, the right child of the root is at offset
2\times 1+1=3, the left child of the left child of the root is at offset 2\times 2=4, and so on. The parent of the
node whose contents are at offset i, is at offset i/2(integer division). Thus, the parent of node at offset 7
is at offset 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!