SlideServe
Menu
Préférences
© SlideServe · v2026

Discrete Mathematics

kane-marquez avatar
24 diapositives · 1.3K Views · Nov 01, 2014

Discrete Mathematics. Chapter 5 Trees. 7.1 Introduction. Tree A tree is a connected undirected graph that contains no circuits. Recall: A circuit is a path of length >=1 that begins and ends a the same vertex. Free tree. A (free) tree T is

Discrete Mathematics - slide 1
01 / 24Discrete Mathematics
1 / 17

Télécharger la présentation

Discrete Mathematics
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Discrete Mathematics Chapter 5 Trees

  2. 7.1 Introduction • Tree • A tree is a connected undirected graph that contains no circuits. • Recall: A circuit is a path of length >=1 that begins and ends a the same vertex.

  3. Free tree A (free) tree T is • A simple graph such that for every pair of vertices v and w • there is a unique path from v to w

  4. Rooted tree A rooted tree is a tree where one of its vertices is designated the root

  5. Let T be a rooted tree: The level l(v) of a vertex v is the length of the simple path from v to the root of the tree The height h of a rooted tree T is the maximum of all level numbers of its vertices: h = max { l(v) } v  V(T) Example: the tree on the right has height 3 Level of a vertex and tree height

  6. 7.2 Terminology

  7. Root • The only node in the tree with no parent • Leaf • A node with no children • Siblings • Nodes with a common parent • Parent of node n • The node directly above node n in the tree • Child of node n • A node directly below node n in the tree

  8. Internal and terminal vertices • An internal vertex is a vertex that has at least one child • A terminal vertex is a vertex that has no children • The tree in the example has 4 internal vertices and 4 terminal vertices

  9. 7.5 Binary trees A binary tree is a tree where each vertex has zero, one or two children

  10. Full binary tree A full binary tree is a binary tree in which each vertex has two or no children.

  11. Data are associated to each vertex Order data alphabetically, so that for each vertex v, data to the left of v are less than data in v and data to the right of v are greater than data in v Binary search trees

  12. Example: Number of nodes=7 Number of comparison=4 Element exists

  13. Example: Number of nodes=7 Number of comparison=3 Element exists

  14. Example: Key=15 Number of nodes=7 Number of comparison=4 Element isn’t exists

  15. Building trees:

  16. Another example:

  17. Operations on trees: • Insert or add on tree.

  18. 2) Deletion.

  19. 7.6 Tree Traversals • 1: Pre-order traversal NLR

  20. 7.6 Tree Traversals • 1: in-order traversal LNR

  21. 3: Post-order traversal More on tree traversals LRN