Complete the sentence to define the depth of a node in a tree.
The depth of a node is the number of edges from the root to the [1] node.
The depth of a node is counted from the root down to the target node itself.
Complete the sentence to define the height of a node in a tree.
The height of a node is the number of edges on the longest path from the node to a [1].
The height of a node measures the longest path down to a leaf node.
Fix the error in the statement about tree height.
The height of the root node is always [1].The height of the root node is equal to the height of the tree, which is the longest path from the root to a leaf node.
Fill both blanks to complete the dictionary comprehension that maps nodes to their depths.
depths = {node: [1] for node in nodes if node [2] root}This comprehension assigns each node's depth by calculating its distance from the root, excluding the root itself.
Fill all three blanks to create a dictionary comprehension mapping nodes to their heights, excluding leaves.
heights = {node: [1] for node in nodes if not [2] and node [3] root}This comprehension calculates the height for each node that is not a leaf and is not the root.