Exemplo n.º 1
0
	void printBoundaryRight(TreeNode* root){
		if(root){
			if(root->right){
				cout<<root->data<<" ";
				printBoundaryRight(root->right);
			}
			else if(root->left){
				cout<<root->data<<" ";
				printBoundaryRight(root->left);
			}
		}
	}
Exemplo n.º 2
0
void printBoundaryRight(struct BSTNode* root)
{
    if (root)
    {
        if (root->right)
	{
	    printBoundaryRight(root->right);
	    printf("%d  ", root->data);
	}
	else if(root->left)
	{
	    printBoundaryRight(root->left);
	    printf("%d  ", root->data);
	}
    }
}
Exemplo n.º 3
0
void printBoundary(struct BSTNode* root)
{
    if (root)
    {
        printf("%d  ", root->data);
	printBoundaryLeft(root->left);
	printLeaves(root->left);
	printLeaves(root->right);
	printBoundaryRight(root->right);
    }
}
Exemplo n.º 4
0
	void printBoundary(TreeNode* root){
		if(root){
			cout<<root->data<<" ";

			//Print all left boundary in top down manner.
			printBoundaryLeft(root->left);

			//Print all leaf node
			printLeaves(root->left);
			printLeaves(root->right);

			//Print all right boundary nodes in bottom up manner.
			printBoundaryRight(root->right);
		}
	}