Why would you need to store all of the integers in an array? You only need to keep track of the max value seen at each node. Creating an array doubles the space you need.
5
Sigiloso
25 de mar. de 2012
step1
you a tranverse the binary tree & save the integers in a array.
step2:
pick the greatest one
RUNNING time O(n) + O(n) ~ O(n)