7.1 Trees.

Slides:



Advertisements
Similar presentations
Chapter 10: Trees. Definition A tree is a connected undirected acyclic (with no cycle) simple graph A collection of trees is called forest.
Advertisements

Trees Types and Operations
Author: Takdir, S.ST. © Sekolah Tinggi Ilmu Statistik.
Introduction to Trees Chapter 6 Objectives
1 Chapter 10 Trees. Tree Definition 1. A tree is a connected undirected graph with no simple circuits. Theorem 1. An undirected graph is a tree if and.
CS2420: Lecture 13 Vladimir Kulyukin Computer Science Department Utah State University.
Lists A list is a finite, ordered sequence of data items. Two Implementations –Arrays –Linked Lists.
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.
Joseph Lindo Trees Sir Joseph Lindo University of the Cordilleras.
Binary Tree. Binary Trees – An Informal Definition A binary tree is a tree in which no node can have more than two children Each node has 0, 1, or 2 children.
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.
1 Trees 2 Binary trees Section Binary Trees Definition: A binary tree is a rooted tree in which no vertex has more than two children –Left and.
Week 11 - Wednesday.  What did we talk about last time?  Graphs  Euler paths and tours.
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.
Lecture 17 Trees CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
Copyright © Cengage Learning. All rights reserved. CHAPTER 10 GRAPHS AND TREES.
CSCI 115 Chapter 7 Trees. CSCI 115 §7.1 Trees §7.1 – Trees TREE –Let T be a relation on a set A. T is a tree if there exists a vertex v 0 in A s.t. there.
Lecture 8 Tree.
2-3 Trees Extended tree.  Tree in which all empty subtrees are replaced by new nodes that are called external nodes.  Original nodes are called internal.
Review 1 Queue Operations on Queues A Dequeue Operation An Enqueue Operation Array Implementation Link list Implementation Examples.
Trees : Part 1 Section 4.1 (1) Theory and Terminology (2) Preorder, Postorder and Levelorder Traversals.
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.
Discrete Mathematics Chapter 5 Trees.
1 Slides by Sylvia Sorkin, Community College of Baltimore County - Essex Campus Trees.
Trees Dr. Yasir Ali. A graph is called a tree if, and only if, it is circuit-free and connected. A graph is called a forest if, and only if, it is circuit-free.
Trees – Page 1CSCI 1900 – Discrete Structures CSCI 1900 Discrete Structures Trees Reading: Kolman, Section 7.1.
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 Mathematical Preliminaries. 2 Sets Functions Relations Graphs Proof Techniques.
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.
More Trees. Outline Tree B-Tree 2-3 Tree Tree Red-Black Tree.
Tree Representation and Terminology Binary Trees Binary Search Trees Pointer-Based Representation of a Binary Tree Array-Based Representation of a Binary.
Chapter 10 Trees © 2006 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.
Lecture 1 (UNIT -4) TREE SUNIL KUMAR CIT-UPES.
Recursive Objects (Part 4)
Graph Graphs and graph theory can be used to model:
Binary search tree. Removing a node
Trees.
Source Code for Data Structures and Algorithm Analysis in C (Second Edition) – by Weiss
Chapter 11: Multiway Search Trees
12. Graphs and Trees 2 Summary
Tree.
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.
Tree traversal from Introduction to Trees Chapter 6 Objectives
CHAPTER 4 Trees.
Trees Trees are a very useful data structure. Many different kinds of trees are used in Computer Science. We shall study just a few of these.
Data Structures and Database Applications Binary Trees in C#
TREES General trees Binary trees Binary search trees AVL trees
CS223 Advanced Data Structures and Algorithms
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.
Lecture 26 Multiway Search Trees Chapter 11 of textbook
Tree A tree is a data structure in which each node is comprised of some data as well as node pointers to child nodes
Relations and Their Properties
Data Structures: Trees and Binary Trees
CSE 373, Copyright S. Tanimoto, 2002 Binary Trees -
Lecture 36 Section 12.2 Mon, Apr 23, 2007
4.5 Equivalence Relations
Representing binary trees with lists
Trees 11.1 Introduction to Trees Dr. Halimah Alshehri.
CSE 373, Copyright S. Tanimoto, 2001 Binary Trees -
2-3 Trees Extended tree. Tree in which all empty subtrees are replaced by new nodes that are called external nodes. Original nodes are called internal.
Binary Trees.
Tree and its terminologies
Heaps Chapter 6 Section 6.9.
Chapter 11 Trees © 2011 Pearson Addison-Wesley. All rights reserved.
A Binary Tree is a tree in which each node has at most 2 children
4.4 Properties of Relations
Presentation transcript:

7.1 Trees

Each element of a tree is called a vertex and noted with a V. Root Level 0 Level 1 children Level 2 children (also called leaves) Each element of a tree is called a vertex and noted with a V. V0 is the root of the tree. The root of a tree does not have a parent. We write (T, V0 )to denote a rooted tree T with a root of V0 . V0 V1 V3 V2 V5 V6 V7 V8 V9 V4

There are no one node cycles in a tree. There is only one root There are no one node cycles in a tree. There is only one root. The root has an in degree of zero. All other verticies have an in degree of 1. The root is at level zero and is the parent of V1, V2, V3. The children or offspring of the root are at level 1. They are V1, V2, V3. V1, V2, V3 are siblings V4 is a child or offspring of V1. V1 is the parent of V4. V4 has no siblings The children or offspring of V1, V2, V3 are at level 2. V4, V5, V6 , V7, V8 and V9 are all at level 2.

The height is the maximum of all levels of its verticies The height is the maximum of all levels of its verticies. The height of our example is 2. The verticies of the tree that have no offspring are called leaves. The leaves of our example are V4, V5, V6 , V7, V8 and V9

Sub trees The following are sub trees of our example. Each of the leaves is a subtree. V4 V5 V6 V7 V8 V9 V1 V2 V3 V4 V6 V5 V9 V8 V7

Trees are: irreflexive, no (a,a),(b,b)…no one node cycles asymmetric aRb bRa not transitive: if you have (a,b) and (b,c) you will not have (a,c) A tree is called an n-tree if every vertex has at most n offspring. If all vertices of T, other than the leaves have exactly n offspring, then the tree is considered to be a complete n-tree.

A complete 2-tree is called a complete binary tree. A 2 tree is called a binary tree. Each vertex has either none, one or two children. A complete 2-tree is called a complete binary tree. a b c d e f g a b c d e f g i h