Trees Flashcards

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

What is a Binary Tree?

A

A binary tree is a collection of nodes. Each node has a data value and references to two other nodes. Each node could have a left child and/or a right child.

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

What is a Tree Node?

A

A tree node typically has a data component and a reference to a left child and a reference to a right child.

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

When adding to a Binary Search Tree, how is the placement decided?

A
  • The left child is less than the parent and the right child is greater.
  • It’s always first compared to the root.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the four different orders?

A

1) In-Order
2) Pre-Order
3) Post-Order
4) Rev-Order

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

What’s the order for In-Order?

A

Left Data Right

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

What’s the order for Pre-Order?

A

Data Left Right

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

What’s the order for Post-Order?

A

Left Right Data

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

What’s the order for Rev-Order?

A

Right Data Left

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

What is the width in a Tree?

A

It’s the distance between two furthest leaves in the tree

does not have to do through the root

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

What is the height in a Tree?

A

It’s the longest part from root to a leaf number of links from root to farthest leaf

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

What is the level in a tree?

A

It’s a group of equal nodes

ex. root is level 0
(ex. the children of the root is level 1)

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

How can a Binary Tree be full?

A
  • Every parent has exactly two children or no children at all.
  • Any levels that are not full have all nodes shifted as far left as possible
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a Expression Tree?

A

A binary expression tree is a binary tree in which each parent node contains an operator and each leaf contains a number.

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

What is a Threaded Tree?

A

A threaded binary tree is a binary tree with an additional reference in each node that is used to point from a child back to its parent.

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