1. 二叉树的根节点的深度为1,所以,对于深度为 d 的行恰好含有 2^{d-1}个节点。
2. 二叉树的深度等于层数
3. 对于一颗完全二叉树的一个节点,
- 其左孩子为:(depth, position) -> (depth + 1, position * 2),
- 其右孩子为 (depth, position) -> (depth + 1, position * 2 + 1)。
1. 二叉树的根节点的深度为1,所以,对于深度为 d 的行恰好含有 2^{d-1}个节点。
2. 二叉树的深度等于层数
3. 对于一颗完全二叉树的一个节点,