



























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An introduction to the tree data structure, covering its definition, components, and related terminology. The tree data structure is a rooted tree that stores information in nodes, with each node having zero or more children. Nodes are classified as internal or leaf, ordered or unordered, and the concepts of parents, children, siblings, paths, depth, height, ancestors, descendants, and subtrees are discussed. The document also includes examples using XHTML and CSS.
Typology: Summaries
1 / 35
This page cannot be seen from the preview
Don't miss anything!




























2
In this topic, we will cover:
4
All nodes will have zero or more child nodes or children
5
The degree of a node is defined as the number of its children: deg(I) = 3 Nodes with the same parent are siblings
7
Leaf nodes: 4.1.1.
8
Internal nodes: 4.1.1.
10
The shape of a rooted tree gives a natural flow from the root node, or just root 4.1.1.
11
A path is a sequence of nodes (a 0 , a 1 , ..., an) where ak + 1 is a child of ak is The length of this path is n E.g., the path (B, E, G) has length 2 4.1.1.
13
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.,
14
Nodes of depth up to 17 9 14 17
4.1.1.
16
The height of this tree is 17 17 4.1.1.
17
If a path exists from node a to node b:
19
All descendants (including itself) of the indicated node 4.1.1.
20
All ancestors (including itself) of the indicated node 4.1.1.