function GetNext(pNode)
{
// write code here
if( pNode == null ){
return null;
}
if( pNode.right != null ){
pNode = pNode.right;
while( pNode.left != null ){
pNode = pNode.left;
}
return pNode;
}
while( pNode.next != null ){
if( pNode.next.left == pNode ){
return pNode.next;
}
pNode = pNode.next;
}
return null;
}

京公网安备 11010502036488号