Skip to content

Files

Latest commit

author
Shoaib Rayeen
Jun 10, 2019
c6b4cbe · Jun 10, 2019

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Apr 4, 2019
Jun 10, 2019
Apr 4, 2019

Given a Binary Tree, find density of it by doing one traversal of it.

Density of Binary Tree = Size / Height 

Input: Root of following tree
   10
  /   \
 20   30

Output: 1.5
Height of given tree = 2
Size of given tree = 3

Input: Root of following tree
     10
    /   
   20   
 /
30
Output: 1
Height of given tree = 3
Size of given tree = 3