11.3 Tree Traversal Flashcards

1
Q

Universal Address Systems

A

A way to totally order the vertices of and ordered rooted tree. We do this recursively:
• Label the root with the integer 0. Then label its k children (at level 1) from left to right with
1, 2, 3, . . . , k.
• For each vertex v at level n with label A, label its kv children, as they are drawn from left to
right, with A.1, A.2, . . . , A.kv.

ex. The lexicographic ordering for this tree is 0

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

PreOrder Traversal

A

Root->Left->Right

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

InOrder Traversal

A

Left->Root->Right

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

PostOrder Traversal

A

Left->Right->Root

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

PostOrder Traversal

A

Left->Right->Root

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

A tree used to solve arithmetic

A

Internal vertices: operations

Leaves: variables or numbers

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

Infix Notation

A

produces the original expression with
the elements and operations in the same order as they originally occurred, except unary operations.
The fully parenthesized expression is the infix form.
Infix form: (6 − 4) ∗ (3 + (5 − 1))

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

Prefix Notation

A

obtained by traversing its rooted tree in preorder. Binary
operator precedes its two operands. Evaluate an expression in prefix form by working right to left.
Prefix form: ∗ − 64 + 3 − 51

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

Postfix Notation

A

obtained by traversing its rooted tree in postorder. Binary operator follows its two operands. Evaluate an expression in postfix form by working left to right.
Postfix form: 64 − 351 − +∗

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