Call traverse(root, array, 0);
int traverse(Node root, int[] a, int index)
{
if(node == NULL)
return index;
int x = traverse(root->left, a, index);
a[x] = root->data;
x = traverse(root->right, a, x+1);
}
Friday, April 25, 2014
Converting a Tree into an Array
Labels:
programming
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment