Time complexity to find the diameter of a binary tree having n nodes is

ISRO Scientist/Engineer SC · 2023 · Computer Science · Part A · Discipline

Time complexity to find the diameter of a binary tree having n nodes is

  1. A.

    O(n2)

  2. B.

    O(n)

  3. C.

    O(1)

  4. D.

    O(logn)

Attempted by 1320 students.

Show answer

Correct answer: B

The worked solution is available to enrolled students.

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…