Trees Flashcards

(34 cards)

1
Q

A non-linear data structure that consists of nodes
and is connected by edges with a hierarchical
organization

A

Trees

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

The nodes in a tree are arranged in a ________________

A

parent-child
relationship

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

The topmost node in a tree is called the ______

A

root node

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

It contains some data and
may have references to its child nodes.

A

Node

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

Each element in tree

A

Node

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

the first node of the tree. And is the initial node of the tree in data structures.

A

Root

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

T or F

In the tree data structure, there must be only one root node.

A

T

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

Represents a connection between two nodes. It defines the relationship between a parent node and its child node. A line connecting the nodes.

A

Edge

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

A node that has one or more child nodes. It is located above its child nodes in the hierarchy.

A

Parent

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

A node that has a parent node. It is located below
its parent node in the hierarchy.

A

Child

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

Nodes that share the same parent. They are at
the same level in the tree.

A

Siblings

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

A node that does not have any child nodes.
It is
also known as a terminal node.

A

Leaf

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

Nodes that have one or more child
nodes. They are neither leaf nodes nor the root node.

A

Internal Nodes

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

the total number of children of a node.

A

DEGREE

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

The
highest degree of the node among all the nodes in a tree.

A

Degree of Tree

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

the distance of a node from the root.

17
Q

The number of edges from the leaf node to the
particular node in the longest path is known as the height
of that node.

18
Q

the height of the root node

A

“Height of Tree”.

19
Q

many edges from the root node to the particular
node

20
Q

In the tree, the total
number of edges from the root node to the leaf node in
the longest path

A

“Depth of Tree”.

21
Q

the sequence of nodes and edges from one node to another node is called the path between those two
nodes. The length of a this is the total number of nodes in this.

22
Q

TYPES OF TREES:

A

• GENERAL TREE:
• BINARY TREE:
• BINARY SEARCH TREE:
• AVL TREE:
• B-TREE:

23
Q

Properties
It follows all properties of the tree data structure.

A node can have any number of nodes.

A

GENERAL TREE:

24
Q

Properties
Follows all properties of the tree data structure.

It can have at most two child nodes.

These two children are called the left child and the right child

25
Properties Left node value<= root node <= right node value Follows all properties of the tree data structure has a unique property known as the binary search property.
BINARY SEARCH TREE
26
Properties Follows all properties of the tree data structure. Self-balancing. Each node stores a value called a balanced factor, which is the difference in the height of the left sub-tree and right sub-tree. All the nodes in the ________ must have a balance factor of -1, 0, and 1.
AVL TREE: (Georgy Adelson-Velsky and Landis - inventor)
27
Properties is a special kind of self-balancing search tree in which each node can contain more than one key and can have more than two children. is also known as a height-balanced m-way tree.
B-TREE
28
• a process of visiting each node and prints their value.
TREE TRAVERSAL
29
LRN
Post-Order Traversal
30
LNR
In-Order Traversal
31
NLR
Pre-Order Traversal
32
Can construct a unique binary tree from pre-order and Post-Order
Cannot!
33
Can construct a unique binary tree from In-Order and Pre-Order ?
Can
34
Can construct a unique binary tree from In-Order and Post-Order?
Can