What is the recursive formula?
Practice this question from Maximum Depth of Binary Tree - Height recursion Pattern Practice Quiz, with options and an explanation.
Question
What is the recursive formula?
Option A — Correct answer
1 + max(left depth, right depth)
Option B
left depth + right depth only
Option C
minimum of all leaf values
Option D
number of right children only
Explanation
Return 1 plus the maximum depth of the left and right subtrees.