Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

The Tree Data Structure: Concepts, Terminology, and Applications, Summaries of Data Structures and Algorithms

An in-depth exploration of the tree data structure, including its concepts, terminology, and applications. Trees are a fundamental data structure used to represent hierarchical relationships and store data efficiently. Topics such as tree terminology, tree types, and tree traversals, using examples from phylogenetic data and xhtml documents.

Typology: Summaries

2023/2024

Uploaded on 01/25/2024

barasa-simon
barasa-simon 🇮🇳

1 document

1 / 62

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
The tree data structure
Trees
COL 106
1
Acknowledgement :Many slides are courtesy
Douglas Harder, UWaterloo
Amit Kumar
Shweta Agrawal
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e

Partial preview of the text

Download The Tree Data Structure: Concepts, Terminology, and Applications and more Summaries Data Structures and Algorithms in PDF only on Docsity!

1

Trees

COL 106

1

Acknowledgement :Many slides are courtesy

Douglas Harder, UWaterloo

Amit Kumar Shweta Agrawal

3 Trees A rooted tree data structure stores information in nodes

  • Similar to linked lists:
    • There is a first node, or root
    • Each node has variable number of references to successors (children)
    • Each node, other than the root, has exactly one node as its predecessor (or parent)

5 To store hierarchy of people

6 To store organization of departments 6

8 To organize file-systems Unix file system

9 Markup elements in a webpage 9

11 Terminology All nodes will have zero or more child nodes or children

  • I has three children: J, K and L For all nodes other than the root node, there is one parent node
  • H is the parent of I

12 Terminology The degree of a node is defined as the number of its children: deg(I) = 3 Nodes with the same parent are siblings

  • J, K, and L are siblings

14 Terminology Nodes with degree zero are also called leaf nodes All other nodes are said to be internal nodes , that is, they are internal to the tree

15 Terminology Leaf nodes:

17 Terminology These trees are equal if the order of the children is ignored ( Unordered tree s ) They are different if order is relevant ( ordered trees )

  • We will usually examine ordered trees (linear orders)
  • In a hierarchical ordering, order is not relevant

18 Terminology The shape of a rooted tree gives a natural flow from the root node , or just root

20 Terminology Paths of length 10 (11 nodes) and 4 (5 nodes) Start of these paths End of these paths

21 Terminology For each node in a tree, there exists a unique path from the root node to that node The length of this path is the depth of the node, e. g .,

  • E has depth 2
  • L has depth 3