English, asked by snehaldhote42, 10 hours ago

A binary tree has 7 nodes, of which there is only one leaf node. What is the depth of the binary tree?​

Answers

Answered by cutiepie243
11

Answer:

The communication process is made up of four key components. Those components include encoding, medium of transmission, decoding, and feedback. There are also two other factors in the process, and those two factors are present in the form of the sender and the receiver.

Explanation:

Answered by varshamittal029
0

Answer:

There are two ideals in binary trees.

The ideal "deepest" tree

The ideal "shallowest" tree

Explanation:

   The ideal "deepest" tree.

*

 *

  *

   *

    a

This tree obviously contains one leaf node, and could have an infinite number of intermediate nodes. This means the maximum depth is unbounded for one leaf node (unless your problem requires internal nodes with more than one child)

          The ideal "shallowest" tree

         *

     *       *

   *   *   *   *

  a a a a a a a a

This tree obviously contains 2^(depth-1) leaves (for trees of depth 1 or greater), and through the magic of math would have a depth of log(base2)(leaves) = depth-1 or 1+log(base2)(leaves). Since we can't have a fractional depth, this must be aligned to ceil(1+log(base2)(leaves))

To test this, let's build a table

          leaves formula                        depth

 1    ceil(1+log(base2)(1)) => ceil(1+0) => ceil(1) => 1

 2    ceil(1+log(base2)(2)) => ceil(1+1) => ceil(2) => 2

 3    ceil(1+log(base2)(3)) => ceil(1+1.58) => ceil(2.58) => 3

 4    ceil(1+log(base2)(4)) => ceil(1+2) => ceil(3) => 3

 5    ceil(1+log(base2)(5)) => ceil(1+2.32) => ceil(3.32) => 4

and so on.

So the range of depth for a tree with n nodes (where n > 0) is

[ceil(1+log(base2)(n)), infinity)

unless there are stronger constraints on the deepest tree.

#SPJ2

Similar questions