Given a perfect binary tree, count the number of nodes with an algorithm that has less than O(n)
time complexity.
Given a binary tree, write an iterator that performs in-order iteration and returns next
as well as hasNext
. It is guaranteed that next
is never called on an empty tree.
Given a binary tree, perform pre-order traversal and flatten it to a linked list such that right
for each node is the next node.
Given a tree, compute next
for each node such that each node points to its next
neighbor to the right.