Question d’entretien chez Amazon

Code to get the depth of a binary tree.

Réponses aux questions d'entretien

Utilisateur anonyme

7 sept. 2011

int depth(node * root) { if (root == null) return 0; return max(depth(root->left), depth(root->right) + 1; }

Utilisateur anonyme

8 juil. 2011

should be easy if you have done it before.