Copy constructor.

Here is a way to copy a binary tree in a recursive way. It's pretty fine. But I'm assumed to write an iterative one as well. Please, someone tell me how can it be done.
P.S. It's quite urgent. Thanks in advance.


template<typename T> NODE<T>* BST<T>::copyTree(NODE<T>* root)
{
NODE<T>* copyNode = NULL;
if (root)
{
copyNode = new NODE<T>();
copyNode->data = root->data;
copyNode->left = copyTree(root->left);
copyNode->right = copyTree(root->right);
}
return copyNode;
}
That code looks ok. Doesn't it work?
It does. But I have an assignment to implement it in an iterative way as well, and I have no idea how to do that.
Topic archived. No new replies allowed.