lesson 21/05/20 Graphs traversal algorithms Flashcards

1
Q

What are the 2 approaches of searching a graph

A

Depth-first and breadth-first

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

does Depth-first use a stack or queue

A

Uses a stack

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

does Breadth-first use a stack or queue

A

Uses a queue

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

describe how a depth-first approach works

A
  • start at the root of graph
  • follow one branch as far as you can go
  • backtrack until you find a new route
  • repeat until you go through every root
  • pop everything off
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

describe how a breadth-first approach works

A
  • start at the root of graph
  • scan each branch the front of queue has
  • pop front when it has no new routes
  • repeat until every route has been scanned
  • pop everything off
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

examples of a real life depth-first approach

A

GPS Navigation systems, computer Networks (peer-to-peer)

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