Sunteți pe pagina 1din 6

Session Objectives

Define Tree and its basic terms


Explain Binary Tree & its Types Discuss AVL Tree Explain Threaded Binary Tree Representation and Operations on Binary tree Discuss Binary Tree Traversal

TREE : It is a non-linear data structure and its elements are arranged in sorted order For eg., Sample Tree Any algebraic expression can be represented with a tree. Z=(J-K)/((L*M)+N), Basic Terms : (i) Root (ii) Node (iii) child (iv) Link (v) Parent (vi) Leaf (vii) Level (viii) Height (ix) Degree (x) Sibling (xi) Terminal Node (xii) Path length (xiii) Forest (xiv) Labeled Tree Binary Tree : It is a finite set of data elements. A Tree is a binary tree, if each node of it has a maximum of two branches. It has either 0 or 1 or 2 child. For eg., Complete Binary Tree : Each node has two children, except the last nodes. Therefore, at any level, the maximum no. of nodes is equal to multiples of 2. For eg., at level 0 only one node (Root) 20 at level 1 two nodes - 21 at level 2 four nodes - 22

Extended Binary Tree : When every node of a tree has either 0 or 2 children
such a tree is called as Extended Binary tree. The nodes with children are called internal nodes, and the node without children are called External node.
Representation of Binary Tree : (i) Array Representation (ii) Linked List Representation

Operation on Binary Tree :


(i) Tree Traversal (ii) Insertion of nodes (iii) Deletion of nodes (iv) Searching for a given node. Tree Traversal : (a) In-order Traversal (b) Pre-order Traversal (c) Post-order Traversal

Binary Search Tree :


(i) Left child value is less than the root node and right child (ii) Right child value is greater than the root node and left child. (iii) Root node value is less than the left child and greater than the right child..

Threaded Binary Tree : In this tree, we find the types of pointer from null
pointer fields to higher nodes in a binary tree. The null pointer fields are used to keep store the address fields of higher nodes in a tree. This is called as Thread.

Threaded Binary Tree Traversal :


In order : One way in order threading Two way in order threading

B-Tree : (Balanced Multi-way Tree)

It is also known as Balanced Sorted Tree. It is used in external sorting.

Condition :
(i) The height of the tree is minimum. (ii) No empty sub tree after the leaves of the tree

(iii) The leaves of the tree should be at the same level.


(iv) All nodes, except the leaves have at least few children. AVL Tree : (Height Balanced Tree)

This form of tree is studied and defined by Russian mathematician G. M. Adelson - Velskii and E.M. Landis. Find Balancing factor for the tree by applying the following condition.
(i) If it is Leaf node, the Balancing factor (BF) is 0.

(ii) If the node is left child of left sub tree,depends upon its depth, BF is calculated and it is positive. (iii) If the node is right child of right sub tree, depends upon its depth, BF is calculated and it is negative.

S-ar putea să vă placă și