First Upload
This commit is contained in:
30
26 - Trees(continue)/ex1.c
Normal file
30
26 - Trees(continue)/ex1.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#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)
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user