Pre Order Binary Tree Traverse

Design a conventional iterative algorithm to traverse a binary tree represented in two dimensional array in preorder.

Questions by Dheerendra_juli

Showing Answers 1 - 1 of 1 Answers

puzzlu

  • Sep 21st, 2010
 

Binary tree in 2 dimensional array?
Here is the solution for binary tree in link list as node

{
int info;
node *left;
node *right;
};

preOreder(node * Tree)
{
push(tree);

while(stack is not empty)
{
myNode= pop();
print myNode->info;
push(node->right);
push(node->left);
}
}

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions