By adding a flag in the nodes you could get the runtime to O(t+a)
(t is size of the tree and a is the size of the array). This is done by first setting the flags in the array then traversing the tree and picking out the values that were flagged.
This is only advantageous if your tree is only log a
times bigger than the array. If t>>a quicksort would definitely be the preferred method as it has a runtime of O(a * log a)
.