插入节点到complete binary tree的末尾# JobHunting - 待字闺中
d*w
1 楼
complete tree定义
a binary tree in which every level, except possibly the last, is completely
filled, and all nodes are as far left as possible.
不能使用额外的空间,
insert(int data, TreeNode root)
例如complete tree
1
2 3
4
插入节点就是成为2的右儿子
1
2 3
4 5
a binary tree in which every level, except possibly the last, is completely
filled, and all nodes are as far left as possible.
不能使用额外的空间,
insert(int data, TreeNode root)
例如complete tree
1
2 3
4
插入节点就是成为2的右儿子
1
2 3
4 5