Introduction to Computer Science 2 Balanced Binary Search Trees (2) & Extended Binary Trees
Introduction to Trees
description
Transcript of Introduction to Trees
Introduction to TreesLecture 161107186 Estrutura de Dados Turma02Prof. Christian Azambuja PagotCI / UFPBUniversidade Federal da ParabaCentro de InformticaWhat is a Tree?In graph theory, a tree is defined as aconnectedExample:acyclicgraph.Node4However, one suchgraph may generatedifferent treedata structures!2Edge15362Universidade Federal da ParabaCentro de InformticaWhat is a Tree?In graph theory, a tree is definedas aRoot nodeconnectedExample:acyclicgraph.4412152543633Universidade Federal da ParabaCentro de InformticaWhat is a Tree?In graph theory, a tree is definedas aconnectedExample:acyclicgraph.Root node1422564153364Universidade Federal da ParabaCentro de InformticaDefinitionsPath LengthNumber of edges on a path.1Depth of a NodeEqual to the path length to the root.8372Height of a NodeEqual to the path length from thenode to its deepest descendant.Height of a Tree49Equal to the heightof the root.565Universidade Federal da ParabaCentro de InformticaDefinitionsChild NodeEach node canchild nodes.Parent Nodehaven18372It is unique fornode.The root does parent node.each49not have566Universidade Federal da ParabaCentro de InformticaDefinitionsLeaf NodeHas no child node.1SiblingsNodes with the sameparent.8372AncestorsAll nodes on the pathto the root.49Descendants of a node nAll nodes that share n as anancestor.567Universidade Federal da ParabaCentro de InformticaDefinitionsSubtreeTree formed by a node1andallitsdescendants.837249568Universidade Federal da ParabaCentro de InformticaDefinitionsTree Arity11n-ary.Binary.2383724495656n-ary treebinary tree9Universidade Federal da ParabaCentro de Informtica