Presentation is loading. Please wait.

Presentation is loading. Please wait.

Types of Binary Trees Introduction. Types of Binary Trees There are several types of binary trees possible each with its own properties. Few important.

Similar presentations


Presentation on theme: "Types of Binary Trees Introduction. Types of Binary Trees There are several types of binary trees possible each with its own properties. Few important."— Presentation transcript:

1 Types of Binary Trees Introduction

2 Types of Binary Trees There are several types of binary trees possible each with its own properties. Few important and frequently used trees are listed as below: 1. Binary search tree 2. Expression tree 3. Heap tree 4. Threaded Binary tree

3 Types of Binary Trees 5. Height balanced tree(AVL tree) 6. 2-3 Trees 7. Weight Balanced tree 8. m-ary Trees tree 9. Trie Structures tree 10. B/B+ tree

4 Binary Search Tree A binary search tree T is termed as binary Search tree (or binary sorted tree) if each node N of T satisfies the following property: The value of the node in the left childe or Left sub tree is less than the value of the root. The value of the node in the right child or right sub tree is more than or equal to the value of the root. All the sub trees of the left & right children observe above two rules.

5 Binary Search Tree Exampel-1

6 Binary Search Tree Example-2

7 Basic Operation on Binary Search Tree Inserting any data into it Deletion any data from it Searching for a data Traversing the data

8 What is different between Tree, Binary tree & Binary Search tree? A tree is a data structure that only allows one parent but multiple children. A Binary Search tree is a specific case of a tree. First, it is a binary tree, meaning that a node can at most have two children. Here, sorting not imported. And it is a binary search tree meaning that the left child of a value is less than the parent value while the right child value is greater than the parent value.

9 Traversal of a Binary Search Tree There are: Preorder traversal (PLR) Inorder traversal(LPR) Postorder traversal(LRP)

10 Traversal of a Binary Search Tree

11 Sequence of the previous example: Preorder traversal (PLR) 16,10,5,14,25,18,90 Inorder traversal(LPR) 5,10,14,16,18,25,90 Postorder traversal(LRP) 5,14,10,18,90,25,16

12 Traversal of a Binary Search Tree

13 Sequence of the previous example: Preorder traversal (PLR) P,H,A,D,K,M,S,R,T,W Inorder traversal(LPR) A,D,H,K,M,P,R,T,S,W Postorder traversal(LRP) D,A,M,K,H,T,R,W,S,P


Download ppt "Types of Binary Trees Introduction. Types of Binary Trees There are several types of binary trees possible each with its own properties. Few important."

Similar presentations


Ads by Google