Fundamentals of algorithms (dijkstra's) Flashcards

(3 cards)

1
Q

What do optimisation algorithms do?

A
  • Find the best possible solution to a problem
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Dijkstra’s algorithm: what does it do, examples

A

Dijkstra’s algorithm finds the shortest path from a starting node to every other node

  • keeps track of visited nodes with a priortity queue
    |
  • Used in satellite navigation systems to find the shortest route between locations
  • Used in routers to send packets via the fastest route through a network
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Dijkstra’s algorithm: How does it work?

A
  1. Select start and end nodes
  2. Make note of distances of nodes from the start position. (Only the nodes connected to start will have a value, all others have a value of infinity)
  3. Note the start node as fully explored. Choose the node cloest to start node, update the table to reflect shortest distance from A to each node. Mark that node as fully explored
  4. Repeat step 3, continue until each node has been fully explored (and hence each edge)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly