Trees and Graphs Flashcards

1
Q

What is a binary tree?

A

A hierarchical data structure where each node has at most two children.

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

What is a binary search tree (BST)?

A

A binary tree where the left child has smaller values and the right child has larger values.

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

What is a graph?

A

A set of nodes (vertices) connected by edges.

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

What is the difference between a directed and an undirected graph?

A

Directed graphs have edges with a direction, while undirected graphs have bidirectional edges.

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

What are common graph representations?

A

Adjacency Matrix (O(V²) space) and Adjacency List (O(V+E) space).

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

What is a full binary tree?

A

A binary tree where every node has either 0 or 2 children.

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

What is a complete binary tree?

A

A binary tree where all levels are completely filled except possibly the last, which is filled from left to right.

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

What is a balanced tree?

A

A tree where the height difference between left and right subtrees is minimal (e.g., AVL Tree).

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

What is an example of an application of graphs?

A

Google Maps (shortest path algorithm), social networks (friend connections).

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