Presentation is loading. Please wait.

Presentation is loading. Please wait.

Joseph Lindo Trees Sir Joseph Lindo University of the Cordilleras.

Similar presentations


Presentation on theme: "Joseph Lindo Trees Sir Joseph Lindo University of the Cordilleras."— Presentation transcript:

1 Joseph Lindo Trees Sir Joseph Lindo University of the Cordilleras

2 Joseph Lindo BST Cases Traversals Binary Tree Trees Course Title Tree In computer science, a tree is an abstract model of a hierarchical structure Trees

3 Joseph Lindo BST Cases Traversals Binary Tree Trees Course Title Binary Tree A binary tree is a finite set of elements that is either empty or is partitioned into three disjoint subsets. The other two subsets are themselves binary trees called the left and right subtrees. Binary Trees

4 Joseph Lindo BST Cases Traversals Binary Tree Trees Course Title Binary Tree The other two subsets are themselves binary trees called the left and right subtrees. Ordered Tree Full binary tree Skewed binary tree Binary Trees

5 Joseph Lindo BST Cases Traversals Binary Tree Trees Course Title Binary Search Tree All identifiers in the left subtree are less than the identifier in the root node All identifiers in the right subtree are greater than the identifier in the root node BST

6 Joseph Lindo BST Cases Traversals Binary Tree Trees Course Title Traversing It is the process of visiting each node in a tree exactly one. Common traversals: Traversals

7 Joseph Lindo BST Cases Traversals Binary Tree Trees Course Title Traversals Preorder Node - Left - Right Inorder Left - Node -Right Postorder Left - Right - Node Level - order Traversals Want an easy way to do INORDER Traversal? SQUISHING

8 Joseph Lindo Trees -- end -- Sir Joseph Lindo University of the Cordilleras

9 Joseph Lindo Trees -- end na -- Sir Joseph Lindo University of the Cordilleras

10 Joseph Lindo Applications Tree  Organization charts  File systems  Programming environments

11 Joseph Lindo Terminologies Tree  Node  Root Node  Parent Node  Siblings  Internal Node  External Node/Leaf/ Terminal

12 Joseph Lindo Terminologies Tree  Ancestors  Descendants  Subtree  Level  Depth  Height  Degree  Weigth

13 Joseph Lindo Properties Binary Tree 2 i-1 : maximum number of nodes on level I of a binary tree 2 k -1: maximum number of nodes in a binary tree of height k

14 Joseph Lindo Examples Traversals

15 Joseph Lindo Squishing INORDER Traversal

16 Joseph Lindo Level - Order Traversal

17 Joseph Lindo Trees -- end -- Sir Joseph Lindo University of the Cordilleras

18 Joseph Lindo Trees -- end na -- Sir Joseph Lindo University of the Cordilleras

19 Joseph Lindo Examples


Download ppt "Joseph Lindo Trees Sir Joseph Lindo University of the Cordilleras."

Similar presentations


Ads by Google