30 lines
508 B
C
30 lines
508 B
C
#include "General.h"
|
|
|
|
BinaryTree * GetBrotherBinaryTree(BinaryTree * root, BinaryTree * p)
|
|
{
|
|
if (root)
|
|
{
|
|
return (NULL);
|
|
}
|
|
else
|
|
{
|
|
if (root->left == p)
|
|
{
|
|
return (root->right);
|
|
}
|
|
else if (root->right == p)
|
|
{
|
|
return (root->left);
|
|
}
|
|
else
|
|
{
|
|
return (GetBrotherBinaryTree(root->left, p) ||
|
|
GetBrotherBinaryTree(root->right, p));
|
|
}
|
|
}
|
|
}
|
|
|
|
void main(void)
|
|
{
|
|
|
|
} |