I found an implementation of the Morris tree traversal,
It works fine,,, but having a bit of a problem trying to traverse the tree in reverse order.. -
void MorrisTraversal(struct Node *root)
{
struct Node *p,*pre;
if(root==0) { return; }
for(p=root;p!=0;)
{
if(p->Left==0) { printf(" %d ",p->Data); p=p->Right; continue; }
for(pre=p->Left;pre->Right!=0 && pre->Right!=p;pre=pre->Right) { }
if(pre->Right==0)
{ pre->Right=p; p=p->Left; continue; }
else
{ pre->Right=0; printf(" %d ",p->Data); p=p->Right; continue; }
}
}