Presentation is loading. Please wait.

Presentation is loading. Please wait.

DATA STRUCTURE Presented By: Mahmoud Rafeek Alfarra Using C# MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE.

Similar presentations


Presentation on theme: "DATA STRUCTURE Presented By: Mahmoud Rafeek Alfarra Using C# MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE."— Presentation transcript:

1 DATA STRUCTURE Presented By: Mahmoud Rafeek Alfarra Using C# MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE Information Technology, 3’rd Semester Lecture 13: Trees

2 Outline  Classification of Data Structures  The definition of a tree  Terminology of Tree  Binary Trees  Binary Search Tree  Emank X Mezank !!

3 Classification of Data Structures 3 Presented & Prepared by: Mahmoud R. Alfarra ClassificationLinearHierarchical

4 The definition of a tree  A tree is a set of nodes connected by edges. An example of a tree is a company’s organization chart 4 Presented & Prepared by: Mahmoud R. Alfarra

5 The definition of a tree 5 Presented & Prepared by: Mahmoud R. Alfarra  The purpose of an organization chart is to communicate to the viewer the structure of the organization. leaf nodes root node internal nodes

6 Terminology of Tree 6 Presented & Prepared by: Mahmoud R. Alfarra  Tree: A collection of data whose entries have a hierarchical organization  Node: An entry in a tree  Root node: The node at the top  Terminal or leaf node: A node at the bottom

7 Terminology of Tree 7 Presented & Prepared by: Mahmoud R. Alfarra  Parent: The node immediately above a specified node  Child: A node immediately below a specified node  Ancestor: Parent, parent of parent, etc.  Descendent: Child, child of child, etc.  Siblings: Nodes sharing a common parent

8 Terminology of Tree 8 Presented & Prepared by: Mahmoud R. Alfarra  Binary tree: A tree in which every node has at most two children  Depth: The number of nodes in longest path from root to leaf

9 Terminology of Tree 9 Presented & Prepared by: Mahmoud R. Alfarra

10 Binary Trees 10 Presented & Prepared by: Mahmoud R. Alfarra  Tree nodes contain two or more links  Most of other data structures we have discussed only contain one  In Binary trees  All nodes contain two links  None, one, or both of which may be NULL  The root node is the first node in a tree.  Each link in the root node refers to a child  A node with no children is called a leaf node

11 Binary Trees 11 Presented & Prepared by: Mahmoud R. Alfarra  Allow the head (and the rear) to be moving targets B A D C

12 Binary Tree Definitions 12 Presented & Prepared by: Mahmoud R. Alfarra  Leaf: node that has no left and right children  Parent: node with at least one child node  Level of a node: number of branches on the path from root to node  Height of a binary tree: number of nodes no the longest path from root to node

13 Binary Tree Implementation Logic 13 Presented & Prepared by: Mahmoud R. Alfarra  Leaf: node that has no left and right children  Parent: node with at least one child node  Level of a node: number of branches on the path from root to node  Height of a binary tree: number of nodes no the longest path from root to node

14 Binary search trees 14 Presented & Prepared by: Mahmoud R. Alfarra Binary search trees Not a binary search tree 5 10 30 22545 5 10 45 22530 5 10 30 2 25 45

15 Emank X Mezank !! أعظم أسبـاب النجاة استعن بالله

16 Next Lecture Examples (Implementation of tree and then Practices )


Download ppt "DATA STRUCTURE Presented By: Mahmoud Rafeek Alfarra Using C# MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE."

Similar presentations


Ads by Google