12-CRS-0106 REVISED 8 FEB 2013 CSG2A3 ALGORITMA dan STRUKTUR DATA.

Slides:



Advertisements
Similar presentations
COSC2007 Data Structures II Chapter 10 Trees I. 2 Topics Terminology.
Advertisements

Andreas Savva Data Structures Chapter 5 Recursion.
Chapter 10: Trees. Definition A tree is a connected undirected acyclic (with no cycle) simple graph A collection of trees is called forest.
Author: Takdir, S.ST. © Sekolah Tinggi Ilmu Statistik.
Introduction to Trees Chapter 6 Objectives
Data Structures: A Pseudocode Approach with C 1 Chapter 6 Objectives Upon completion you will be able to: Understand and use basic tree terminology and.
TREES Chapter 6. Trees - Introduction  All previous data organizations we've studied are linear—each element can have only one predecessor and successor.
Class 8: Trees. cis 335 Fall 2001 Barry Cohen Definitions n A tree is a nonlinear hierarchical structure (more than one successor) n Consists of nodes.
Binary Tree Terminology Linear versus hierarchical data Tree – connected graph with no cycles Child Parent Descendant Sibling Ancestor Leaf vs. internal.
1 Trees. 2 Outline –Tree Structures –Tree Node Level and Path Length –Binary Tree Definition –Binary Tree Nodes –Binary Search Trees.
A tree is a simple graph satisfying: if v and w are vertices and there is a path from v to w, it is a unique simple path. a b c a b c.
Rooted Trees. More definitions parent of d child of c sibling of d ancestor of d descendants of g leaf internal vertex subtree root.
CSC 2300 Data Structures & Algorithms February 6, 2007 Chapter 4. Trees.
Binary Trees Chapter 6.
COSC2007 Data Structures II
CS261 Data Structures Trees Introduction and Applications.
12-CRS-0106 REVISED 8 FEB 2013 CSG2A3 ALGORITMA dan STRUKTUR DATA.
Introduction Of Tree. Introduction A tree is a non-linear data structure in which items are arranged in sequence. It is used to represent hierarchical.
Saturday, 04 Apr 2010 University of Palestine Computer Science II Trees.
Tree A connected graph that contains no simple circuits is called a tree. Because a tree cannot have a simple circuit, a tree cannot contain multiple.
Binary Trees. Binary Tree Finite (possibly empty) collection of elements A nonempty binary tree has a root element The remaining elements (if any) are.
Copyright © Cengage Learning. All rights reserved. CHAPTER 10 GRAPHS AND TREES.
Tree (new ADT) Terminology:  A tree is a collection of elements (nodes)  Each node may have 0 or more successors (called children)  How many does a.
Trees Chapter 8. 2 Tree Terminology A tree consists of a collection of elements or nodes, organized hierarchically. The node at the top of a tree is called.
TREES. What is a tree ? An Abstract Data Type which emulates a tree structure with a set of linked nodes The nodes within a tree are organized in a hierarchical.
Trees CS 105. L9: Trees Slide 2 Definition The Tree Data Structure stores objects (nodes) hierarchically nodes have parent-child relationships operations.
Data Structures TREES.
DATA STRUCTURE Presented By: Mahmoud Rafeek Alfarra Using C# MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE.
Trees : Part 1 Section 4.1 (1) Theory and Terminology (2) Preorder, Postorder and Levelorder Traversals.
Disusun Oleh : Budi Arifitama Pertemuan ke-8. Define trees as data structures Define the terms associated with trees Discuss tree traversal algorithms.
12-CRS-0106 REVISED 8 FEB 2013 CSG2A3 ALGORITMA dan STRUKTUR DATA.
Trees By P.Naga Srinivasu M.tech,(MBA). Basic Tree Concepts A tree consists of finite set of elements, called nodes, and a finite set of directed lines.
M180: Data Structures & Algorithms in Java Trees & Binary Trees Arab Open University 1.
DATA STRUCTURE BS(IT)3rd. Tree An Introduction By Yasir Mustafa Roll No. BS(IT) Bahauddin Zakariya University, Multan.
Data Structures Lakshmish Ramaswamy. Tree Hierarchical data structure Several real-world systems have hierarchical concepts –Physical and biological systems.
CHAPTER 11 TREES INTRODUCTION TO TREES ► A tree is a connected undirected graph with no simple circuit. ► An undirected graph is a tree if and only.
1 Trees What is a Tree? Tree terminology Why trees? What is a general tree? Implementing trees Binary trees Binary tree implementation Application of Binary.
BINARY TREES Objectives Define trees as data structures Define the terms associated with trees Discuss tree traversal algorithms Discuss a binary.
Chapter 6 – Trees. Notice that in a tree, there is exactly one path from the root to each node.
1 Trees : Part 1 Reading: Section 4.1 Theory and Terminology Preorder, Postorder and Levelorder Traversals.
Trees By JJ Shepherd. Introduction Last time we discussed searching and sorting in a more efficient way Divide and Conquer – Binary Search – Merge Sort.
Trees A non-linear implementation for collection classes.
What is a Tree? Formally, we define a tree T as a set of nodes storing elements such that the nodes have a parent-child relationship, that satisfies the.
Section10.1: Introduction to Trees
TREES From root to leaf. Trees  A tree is a non-linear collection  The elements are in a hierarchical arrangement  The elements are not accessible.
Trees. Trees: – A trunk from the roots – Divides into branches – Ends in leaves.
Data Structures and Design in Java © Rick Mercer
Lecture 1 (UNIT -4) TREE SUNIL KUMAR CIT-UPES.
Trees.
Source Code for Data Structures and Algorithm Analysis in C (Second Edition) – by Weiss
Binary Trees "A tree may grow a thousand feet tall, but its leaves will return to its roots." -Chinese Proverb.
Introduction to Trees Section 11.1.
Section 8.1 Trees.
Trees What is a Tree? Tree terminology Why trees?
Lecture 18. Basics and types of Trees
Trees and Binary Trees.
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 10 Trees Slides are adopted from “Discrete.
Week nine-ten: Trees Trees.
Data Structures: Trees and Binary Trees
Computer Science and Engineering
Lecture 36 Section 12.2 Mon, Apr 23, 2007
Tree.
Binary Trees.
Tree and its terminologies
General Tree Concepts Binary Trees
8.2 Tree Traversals Chapter 8 - Trees.
Introduction to Trees Chapter 6 Objectives
Trees.
Cs212: Data Structures Lecture 7: Tree_Part1
Presentation transcript:

12-CRS-0106 REVISED 8 FEB 2013 CSG2A3 ALGORITMA dan STRUKTUR DATA

12-CRS-0106 REVISED 8 FEB 2013 The data structure consists of a root, and sub trees in a hierarchical arrangement. A form of non-linear data structures 2 Definition

12-CRS-0106 REVISED 8 FEB 2013 Usually used to describe, hierarchical data relationships, such as : –organizational structure –classification tree / genealogy –syntax tree / tree expression 3 Definition

12-CRS-0106 REVISED 8 FEB 2013 Organization Structure –Family tree –Tournament tree 4 Example

12-CRS-0106 REVISED 8 FEB 2013 Organization Structure Arithmetic expression Example : (4+3*7)-(5/(3+4)+6 5 Example

12-CRS-0106 REVISED 8 FEB 2013 Organization Structure Arithmetic expression Decision Tree 6 Example

12-CRS-0106 REVISED 8 FEB 2013 Leaf Connection between nodes –(parent, child, sibling) Level Degree Height and depth Ancestor and Descendant Forest 7 Tree Terminology

12-CRS-0106 REVISED 8 FEB 2013 Tree Terminology Tree is a collection of many nodes Each node may have 0 or more successor Each node has precisely one predecessor –except the peak node (root) Root is the top node in a tree Links that connect a node to its successors are called branches / edges 8

12-CRS-0106 REVISED 8 FEB 2013 Tree Terminology Successors of a node are called children (child) Predecessor of a node is called parent Nodes with the same parent are called siblings Nodes with no children are called leaf/external node Number of children / sub trees of a node is called degree 9

12-CRS-0106 REVISED 8 FEB 2013 Tree Terminology Descendant is a list of all child / successor to the leaf Ancestor is a list of predecessor / from parent to root The level of a node is defined by 1 + the number of connections between the node and the root. 10

12-CRS-0106 REVISED 8 FEB 2013 Tree Terminology The height of a tree is the number of edges on the longest downward path between the root and a leaf. The height of a node is the number of edges on the longest downward path between that node and a leaf. The depth of a node is the number of edges from the node to the tree's root node 11

12-CRS-0106 REVISED 8 FEB 2013 Terminology Root Node / Vertex Degree = 2 Degree = 3 Degree = 0 12

12-CRS-0106 REVISED 8 FEB 2013 Exercise on Tree Terminology Root = Sibling C = Parent F = Child B = Leaf = Internal Node = Level E = Tree height= Degree B = Ancestor I= Descendant B = 13

12-CRS-0106 REVISED 8 FEB 2013 Exercise on Tree Terminology Create the tree Dataset: {A, X, W, H, B, E, S} Root: A Ancestor of S: {E, A} {X, W, E} are siblings {H, B} are descendant and both are children of W 14

12-CRS-0106 REVISED 8 FEB 2013 Question?

12-CRS-0106 REVISED 8 FEB 2013 Tree Notations / Representing Tree Tree Diagram Notation –Classical node-link diagrams Venn Diagram Notation –Nested sets / Tree Maps Bracket Notation –Nested Parentheses Level Notation –Outlines / tree views 16

12-CRS-0106 REVISED 8 FEB 2013 Tree Diagram Notation 17

12-CRS-0106 REVISED 8 FEB 2013 Venn Diagram Notation 18

12-CRS-0106 REVISED 8 FEB 2013 Bracket Notation 19

12-CRS-0106 REVISED 8 FEB 2013 Level Notation 20

12-CRS-0106 REVISED 8 FEB 2013 Exercise on Tree Notation Create the tree in Venn Diagram, Bracket, and level notation 21 X Y RS Q TWUZ P MN

12-CRS-0106 REVISED 8 FEB 2013 Question?

12-CRS-0106 REVISED 8 FEB 2013 THANK YOU 23