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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

TREES<br />

Binary tree: A binary tree consists of a finite set of elements that can be<br />

partitioned into three distinct sub‐ sets called the root, the left and the right<br />

sub‐tree.If there are no elements in the binary tree ,it is known as empty binary<br />

tree.A binary tree ‘T’ is either empty or has a finite collections of<br />

elements.When the binary tree is not empty,one of its elements is called the<br />

root and the remaining elements,if any,are partitioned into two binary<br />

trees,which are known as left & right sub tree of T.<br />

The essential difference between a binary tree and a tree are<br />

A binary tree can be empty whereas a tree cannot.Each element in binary tree<br />

has at most two sub‐trees(one or both of these sub‐tree may be empty).Each<br />

element in a tree can have any number of sub‐trees.<br />

The sub‐trees of each element in a binary tree are ordered.That is,we<br />

distinguish between the left and right sub tree.The sub tree in a tree are<br />

unordered.<br />

Here are some of the binary trees that represents arithmetic expressions.Each<br />

operator(+, ‐, *, /) may have one or two operands.The left operand ,if any,is the<br />

left sub‐tree of the operator & the right operand is the right<br />

sub tree.The leaf elements in an expression tree are either constants or<br />

variables.<br />

Prepared By :­<br />

Er. Harvinder Singh<br />

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

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

Saved successfully!

Ooh no, something went wrong!