int Depth(Node *pRoot)
{
    if (!pRoot)
        return 0;

    int leftDepth = Depth(pRoot->pLeft);
    int rightDepth = Depth(pRoot->pRight);

    return (leftDepth > rightDepth) ? (leftDepth + 1) : (rightDepth + 1);
}

 

 

 

 

 

EOF

相关文章:

  • 2022-01-22
  • 2022-12-23
  • 2021-11-13
  • 2021-06-03
  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
猜你喜欢
  • 2022-12-23
  • 2021-12-03
  • 2021-05-18
  • 2021-04-17
  • 2021-09-07
  • 2022-12-23
相关资源
相似解决方案