1 / 6

CHAPTER 14

CHAPTER 14. TREE (BINARY). 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.

ione
Download Presentation

CHAPTER 14

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CHAPTER 14 TREE (BINARY) SRM-MCA

  2. 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

  3. 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

  4. 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

  5. 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

  6. 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. Adel’son - 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.

More Related