Saturday, May 22, 2010

Theoretically should this algorithm work?C++ Algorithm?

Theoretically speaking if one wanted to swap the sub trees of a binary tree wouldnt it be as simple as telling the roots left pointer to point to the right pointer and the right pointer to point to the left pointer??





Or is there more to it?

Theoretically should this algorithm work?C++ Algorithm?
You'll want a temp var in there of course.





tempPtr = rightPtr


rightPrt = leftPtr


leftPtr = tempPtr


No comments:

Post a Comment