11.1 Introduction to trees Flashcards

1
Q

Trees introduction:

A

A connected graph that contains no simple circuits is called a tree.

Trees can be used
to model procedures carried out using a sequence of decisions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Definition 1:

Tree

A

A tree is a connected undirected graph with no simple circuits.

-Because a tree cannot have a simple circuit, a tree cannot contain multiple edges or loops. Therefore any tree must be a simple graph.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Forests :

A

graphs containing
no simple circuits that are not necessarily connected.

These graphs are called forests and have
the property that each of their connected components is a tree.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Thm 1 :

Alternative defition of tree:

prove it.

A

An undirected graph is a tree if and only if there is a unique simple path between any two of
its vertices.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Definition 2:

Rooted Tree:

and lil more info bout it.. generic.

A

A rooted tree is a tree in which one vertex has been designated as the root and every edge is
directed away from the root.

Note that
different choices of the root produce different rooted trees.
- Arrows can be omitted as the choice of root determines the direction and roots usually at top.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Rooted trees can also be defined recursively.

A

Refer to Section 5.3 to see how this can be done

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Terminology for trees :

just mention dont define:

The terminology for trees has botanical and genealogical origins

A
  1. Parent
  2. Child
  3. Siblings.
  4. Ancestors
  5. Descendants
  6. leaf
  7. Internal vertices
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Parent and child ?

Sibling :

A

If v is a vertex in T other than the root, the parent of v is the unique vertex u such that there
is a directed edge from u to v (the reader should show that such a vertex is unique). When u is
the parent of v, v is called a child of u

Vertices with the same parent are called siblings.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Ancestors and Descendants :

A

The
ancestors of a vertex other than the root are the vertices in the path from the root to this vertex,
excluding the vertex itself and including the root (that is, its parent, its parent’s parent, and so
on, until the root is reached). The descendants of a vertex v are those vertices that have v as
an ancestor.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

leaf and internal vertices :

when is a root leaf ?
when is it internal vertex ?

A

A vertex of a rooted tree is called a leaf if it has no children. Vertices that have
children are called internal vertices. The root is an internal vertex unless it is the only vertex
in the graph, in which case it is a leaf.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Subtree

A

If a is a vertex in a tree, the subtree with a as its root is the subgraph of the tree consisting
of a and its descendants and all edges incident to these descendants.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Definition 3:

m-ary tree?

full m-ary tree ?

binary tree?

A

A rooted tree is called an m-ary tree if every internal vertex has no more than m children.
The tree is called a full m-ary tree if every internal vertex has exactly m children. An m-ary
tree with m = 2 is called a binary tree.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

ORDERED ROOTED TREES :

A

An ordered rooted tree is a rooted tree where the children
of each internal vertex are ordered.
Ordered rooted trees are drawn so that the children of each
internal vertex are shown in order from left to right. Note that a representation of a rooted tree
in the conventional way determines an ordering for its edges. We will use such orderings of
edges in drawings without explicitly mentioning that we are considering a rooted tree to be
ordered.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

About ordered binary tree :

A

In an ordered binary tree (usually called just a binary tree), if an internal vertex has two
children, the first child is called the left child and the second child is called the right child.
The tree rooted at the left child of a vertex is called the left subtree of this vertex, and the tree
rooted at the right child of a vertex is called the right subtree of the vertex.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Tree, number edges and vertices relation: connected graph too.

A

Because the graph is connected and the number of edges is one less than
the number of vertices, it must be a tree

Ex. 15

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

11.1.3 Properties of Trees

thm 2:
Tree’s vertices and edges :

A

A tree with n vertices has n − 1 edges

prove it:

17
Q

Talk about:

what does thm 2 tell :

A

tree is a connected undirected graph with no simple circuits.
So when G is undirected graph with n vertices:
Theorem 2 tells us that the two conditions
(i) G is connected
and (ii) G has no simple circuits,
imply (iii) G has n − 1 edges.

when two of (i), (ii), and (iii) hold, the third condition must also
hold, and G must be a tree.

18
Q

COUNTING VERTICES IN FULL m-ARY TREES

thm 3:

proof:

A

A full m-ary tree with i internal vertices contains n = mi + 1 vertices.

19
Q

Suppose that T is a full m-ary tree. Let i be the number of internal vertices and l the number
of leaves in this tree. Once one of n, i, and l is known, the other two quantities are determined.
Theorem 4 explains how to find the other two quantities from the one that is known.

A

A full m-ary tree with
(i ) n vertices has i = (n − 1)∕m internal vertices and
l = [(m − 1)n + 1]∕m leaves,
(ii ) i internal vertices has n = mi + 1 vertices and
l = (m − 1)i + 1 leaves,
(iii ) l leaves has n = (ml − 1)∕(m − 1) vertices and
i = (l − 1)∕(m − 1) internal vertices.

proof : using n = mi +1, n = l + i

20
Q

Level?

Height?

A

The level of a vertex v in a rooted tree is the length of the unique
path from the root to this vertex. The level of the root is defined to be zero.
The height of a rooted tree is the maximum of the levels of vertices. OR, the height of a rooted tree is
the length of the longest path from the root to any vertex.

21
Q

BALANCED m-ARY TREES

A

A rooted m-ary tree of height h is balanced if all leaves are at levels h or h − 1.

It is often desirable to use rooted trees that are “balanced” so
that the subtrees at each vertex contain paths of approximately the same length.

22
Q

A BOUND FOR THE NUMBER OF LEAVES IN AN m-ARY TREE

THM 5

A

There are at most m^h leaves in an m-ary tree of height h

prove it.

23
Q

COROLLARY 1

if l leaves then h? if its full and balanced m ary the h?

A

If an m-ary tree of height h has l leaves, then h ≥ ⌈logm l⌉. If the m-ary tree is full and balanced,
then h = ⌈logm l⌉.

Prove it.