Week 4: Trees Flashcards

1
Q

What are some applications of a tree data structure?

A

Organzation of a company

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

What are the following groupings called corresponding to the following tree:

Root node, parent nodes, sibling nodes, children nodes

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

For the following tree, what nodes are:

Descendants of B

Descendants of A

Ancestors of J

Ancestors of A

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

What is an internal node? An external/leaf node?

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

What is the depth of a node? Height of a tree?

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

What are the following:

Depth of a tree

Height of a tree

Degree of a node

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

The degree of all nodes of a tree is equal to…

A

The number of edges

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

What is a subtree?

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

What is an odered tree?

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

Example of ordered trees:

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

What are unordered trees? Examples.

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

The number of nodes in a tree is equal to…

A

The number of edges + 1

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

The Tree ADT contains what methods?

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

What is the algorithm for computing the height of a tree?

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

Height of a tree algorithm with call stack:

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

What is preorder traversal? What is the algorithm?

A
17
Q

What is postorder traversal? What is the algorithm?

A
18
Q

What traversal would you use for the following? Why? What is the algorithm.

A

Preorder traversal

19
Q

What travrsal would you use for the following? Why? What is the algorithm?

A
20
Q

What is a binary tree? What properties must a binary tree have?

A
21
Q

For binary tree, what is the number of leaves equal to?

A
22
Q

For binary trees:

The number of nodes at level i is equal to?

The number of leaves is equal to?

A
23
Q

What methods do the BinaryTree ADT have?

A
24
Q

What is an inorder traversal? What is the algorithm?

A
25
Q

Example of the three different types of traversals:

A
26
Q

Example of PRINTING an arithmetic expression using inorder traversal

A
27
Q

Example of EVALUATING an arithmetic expression using a binary tree inorder traversal:

A
28
Q

What does a linked structure of a NON-binary tree look like?

A
29
Q

What does a linked structure of a binay tree look like?

A