Binary trees Flashcards

1
Q

Node

A

A node is a fundamental part of a tree. It can have a name, which we call the key. A node may also have additional information. We call this additional information the value or payload. While the payload information is not central to many tree algorithms, it is often critical in applications that make use of trees.

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

Edge

A

An edge is another fundamental part of a tree. An edge connects two nodes to show that there is a relationship between them. Every node (except the root) is connected by exactly one incoming edge from another node. Each node may have several outgoing edges.

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

Root

A

The root of the tree is the only node in the tree that has no incoming edges. In Figure 2, / is the root of the tree.

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

Path

A

A path is an ordered list of nodes that are connected by edges.

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

Children

A

The set of nodes that have incoming edges from the same node are said to be the children of that node.

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

Parent

A

A node is the parent of all the nodes it connects to with outgoing edges.

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

Sibling

A

Nodes in the tree that are children of the same parent are said to be siblings.

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

Si tree

A

A subtree is a set of nodes and edges comprised of a parent and all the descendants of that parent.

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

Leaf Node

A

A leaf node is a node that has no children.

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

Level

A

The level of a node n is the number of edges on the path from the root node to n.

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

Height

A

The height of a tree is equal to the maximum level of any node in the tree.

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

BinaryTree()

A

BinaryTree() creates a new instance of a binary tree.

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

get_root_val()

A

get_root_val() returns the object stored in the current node.

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

set_root_val(val)

A

set_root_val(val) stores the object in parameter val in the current node.

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

get_left_child()

A

get_left_child() returns the binary tree corresponding to the left child of the current node.

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

get_right_child()

A

get_right_child() returns the binary tree corresponding to the right child of the current node.

17
Q

insert_left(val)

A

insert_left(val) creates a new binary tree and installs it as the left child of the current node.

18
Q

insert_right(val)

A

insert_right(val) creates a new binary tree and installs it as the right child of the current node.