Use stack for iterativeway of tree traversal