Width and height of binary tree is $\theta(n)$?

631 Views Asked by At

we know this definition:

Given a binary tree, Width of a tree is maximum of widths of all levels.

Let us consider the below example tree.

     1
    /  \
   2    3
 /  \     \
4    5     8 
          /  \
         6    7

For the above tree, width of level 1 is 1, width of level 2 is 2, width of level 3 is 3 width of level 4 is 2.

So the maximum width of the tree is 3.

can we have a binary tree with Height $\theta(n)$ and Width $\theta(n)$

My solution: is YES. for example a binary tree with one-node:

     1

am i right?

1

There are 1 best solutions below

0
On

The answer is no.

the Symbol $\Theta (n)$ is related to Average case for set of (bigger) n. So with one tree you couldn't say the tree with one-node has $\Theta (n)$ in height and width.