题目描述
Category:Medium Tree
Given a binary tree, write a function to get the maximum width of the given tree. The width of a tree is the maximum width among all levels. The binary tree has the same structure as a full binary tree, but some nodes are null.
The width of one level is defined as the length between the end-nodes (the leftmost and right most non-null nodes in the level, where the null nodes between the end-nodes are also counted into the length calculation.
题目理解
给定一棵二叉树,求二叉树的最大宽度。二叉树某层的宽度是指其最左节点与最右节点之间的跨度。
解题思路
层序遍历
层次遍历 + 完全二叉树的节