node *root;

node * build(int height)
{
node *r, *temp;
for(i=1, r=null; i<=height && root; i++)
{
temp = root;
root=root->left;
temp->right=r;
r=temp;
r->left = build(i-1);
}
return r;
}

void main()
{
node *tree;

tree = buld(n); // n=height of of new tree
}

i think this will take O(N) time and logN space... plz check

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to