Double tree of search

We have a filledin binary tree of search with tops containing fields.
info
 the meaning,left
 Leg support,right
 the rightwing witness.It's necessary to find the "high" backup, where there are exactly two arcs out of each elastic top. Such support is always available, as the conditionality sheet is also a solution (and there may be a few decisions sufficient to remove any of them).
This is my transcurring function, which is originally provided by the index to the root knot and any index that will be subsequently answered:
bool Find(Node *t, Node * &p) { Node *p1; if (IsLeaf(t)) { p = t; return true; } else if (p1 = IsOneRoot(t)) { Find(p1,p); return false; } else { Node *pl,*pr; bool b1 = Find(t>left,pl),b2=Find(t>right,pr); if (b1 && b2) { p = t; return true; } else p = ( IsLeaf(pl) ? pr : pl ); return false; } }
where
Node
 a structure with the above three fields;IsLeaf(Node *x)
returnstrue
if*x
 leaflet;IsOneRoot(Node *x)
returns the index to the only descendant if the descendant is the descendant2
or0
It's coming back.0
♪The function passes all tests except for type tests:
20 15 25 13 17 23 27 16 30
For this test, it turns out
30
, although the idea is to get out.13
or23
that's because they're higher. What's the mistake?

You always choose the year that stands right, not above:
p=(IsLeaf(pl) ? pr : pl);
The height in your algorithm doesn't compare. If you need to compare the height, it's worth returning not only the peak we found, but also the depth they found it. Or rewrite the recurring overflow, across the layer.