The maximum height of a binary tree with ‘n’ nodes is ______.

2020

The maximum height of a binary tree with ‘n’ nodes is ______.

  1. A.

    (n + n)

  2. B.

    (n + 1)

  3. C.

    n

  4. D.

    (n − 1)

Attempted by 470 students.

Show answer & explanation

Correct answer: D

The correct answer depends on the height definition used. If height is the number of edges on the longest path, the maximum height of a skewed binary tree with n nodes is (n - 1). If height is measured by nodes (levels), it is n. Based on Option D being marked correct, this platform defines height by edges, making Option D the intended correct choice, despite the conflicting feedback text in Option C.

Explore the full course: Niacl Ao It Specialist