횽들 이진트리에서 높이 구하는 프로그램 짜고있는데
void get-height(TreeNode *root){
if (h!=NULL)
return 1+max(get-height(h.left), get-height(h.right));
int get-height(TreeNode *root)
{
int height = 0;
if( root != NULL )
height = 1 + max(get-height(root->left), get-height(root->right));
<?xml:namespace prefix = o ns = \"urn:schemas-microsoft-com:office:office\" /><o:p></o:p>
return height;
}
식이 이건데 오른쪽이랑 왼쪽 비교해야하는데
어캐해야할 지모르겠어
자비좀요 ㅜㅜ
완성된거 같은데..; 리커시브하게 잘 돌아갈거 같은데 get-height에 루트노드 집어넣어봐염.
max 함수 구현을 못 하겠다는건가...
max말고 MAX ㅂㅅ아