Chapter 30 Flashcards

1
Q

What is the difference between stack and queue

A

In stack, the elements who goes first, comes out last (LIFO)

In queue, the elements who goes first, comes out first (FIFO)

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

What is total time of depth-first traversal

A

O(E) (it is polynomial time)

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

What is the time of finding all neighbors of vertex in line 7, if graph is represented using adjacency matrix

A

O(V) time

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

Does DFS and BFS always yield a tree

A

Yes

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