4.3.2 Tree Traversal Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is tree traversal?

A

The process of visiting/updating/outputting each node in a tree.

It is an Algorithm

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

What is an algorithm?

A

A set of instructions with a set of instructions that complete in a finite amount of time and always terminates upon the completion of a task.

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

Name the three types of tree-traversal.

A

Preorder, inorder, post-order

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

Name a use of postorder traversal.

A
  • Emptying a tree
  • Infix to RPN
  • Producing a postfix expression from an expression tree
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which tree-traversal would be used for copying the tree?

A

Preorder traversal

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

Name a use of inorder traversal?

A

Outputting the contents of a binary search tree in ascending order.

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

Can inorder traversal be performed on any tree?

A

No, only binary trees

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

Can preorder traversal be performed on any tree?

A

Yes

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

Can postorder be performed on any tree?

A

Yes

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

Where does tree traversal start?

A

At the root node

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

How do traversals work their way around a tree?

A

Anticlockwise

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

Where does the dot go for inorder?

A

Bottom

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

Where does dot go for preorder

A

Left

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

Where does dot go for postorder

A

Right

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