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 />

ADVANTAGES:‐<br />

This representation is very efficient when<br />

i. The tree is complete<br />

ii. The structure of the tree will notbe modified<br />

ALGORITHM:‐<br />

Binary tree : an array implementation<br />

STEP 1:‐root is A[1]<br />

STEP 2:‐for element A[i]<br />

Left child is in position A[2i]<br />

Right child is in position A[2i+1]<br />

STEP 3:‐parent is in A[i/2]<br />

LINKED BINARY TREE IMPLEMENTATION:‐<br />

Children<br />

A non‐empty binary tree consists of a root and two children which are<br />

binary trees once again. Since the definition of this data structure is<br />

recursive,an appropriate rep. could be self‐referential structure. Each node<br />

of a tree is represented by a structure.each node contains two links to the<br />

same structure:‐left and right. If tree is NULL then the tree is empty<br />

Prepared By :­<br />

Er. Harvinder Singh<br />

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

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

Saved successfully!

Ooh no, something went wrong!