Another way of representing a binary tree is to use an array. The items in the tree are assigned to locations in the array in a level-order fashion. For example, Figure 25-11 shows an array that...


Another way of representing a binary tree is to use an array. The items in the tree are assigned to locations in the array in a level-order fashion. For example, Figure 25-11 shows an array that represents the binary tree in Figure 25-10. Notice that gaps in the array correspond to missing nodes in the tree. The array is sufficiently large to represent any binary tree up to height 4.


An array for Exercise 19 that represents the binary tree in Figure 25-10


a. What are the indices of the children of the node stored at index i?


b. What is the parent of the node stored at index i?


c. What are the advantages and disadvantages of this representation?

Nov 22, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here