10.09.2013 Views

1. Advanced Data Structure using C++

1. Advanced Data Structure using C++

1. Advanced Data Structure using C++

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

LECTURE NOTES OF ADVANCED DATA STRUCTURE (MT-CSE 110)<br />

Some of the properties of binary tree :<br />

A binary tree with ‘n’ elements n>0,Has exactlyn‐1 edges.<br />

A binary tree of height ‘h’,h>0,has atleast h and atmost 2*..2 ‐1<br />

elements in it.<br />

The height of the binary tree that contains n elements ,n>0,is atmost n &<br />

atleast [log8..2(n+1)].<br />

Let i,1n, then this element has no left child. Otherwise,its left child has been<br />

assigned the number 2i.<br />

If 2i+1>n, then this element has no right child.Otherwise,its right child has been<br />

assigned the number 2i+<strong>1.</strong><br />

The number of nodes n in a perfect binary tree can be found <strong>using</strong> this formula:<br />

n = 2 h + 1 − 1 where ‘h’ is the height of the tree.<br />

The number of nodes n in a complete binary tree is minimum: n = 2 h and<br />

maximum: n = 2 h + 1 − 1 where h is the height of the tree.<br />

The number of nodes n in a perfect binary tree can also be found <strong>using</strong> this<br />

formula: n = 2L − 1 where L is the number of leaf nodes in the tree.<br />

The number of leaf nodes n in a perfect binary tree can be found <strong>using</strong> this<br />

formula: n = 2 h where h is the height of the tree.<br />

he number of NULL links in a Complete Binary Tree of n‐node is (n+1).<br />

The number of leaf node in a Complete Binary Tree of n‐node is UpperBound(n /<br />

2).<br />

Prepared By :­<br />

Er. Harvinder Singh<br />

Assist Prof., CSE, H.C.T.M (Kaithal) Page ‐ 178 ‐

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!