Breadth-first Search Flashcards

1
Q

What is graph?

A

A graph models a set of connections
Graphs are made up of nodes and edges. A node can be directly connected to many other nodes. Those nodes are called its neighbors.

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

What is breadth-first algorithm?

A

It’s a graph search algorithm

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

What is queue?

A

It’s a data structure that store items, have two action: enqueue and dequeue, it’s use the first in first out technique.

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

What is the breadth first algorithm running time ?

A

Adding to queue => o(1)
Search => O(V+E) (V for number of vertices, E for number of edges).

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

What is topological sort?

A

If task A depends on task B, task A shows up later in the list. This is called a topological sort, and it’s a way to make an ordered list out of a graph.

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

What is tree?

A

is a special type of graph, where no edges ever point back.

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

What is the difference between direct and undirect graph?

A

• A directed graph has arrows, and the relationship follows the direction of the arrow.
• Undirected graphs don’t have arrows, and the relationship goes both ways.

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