Enrol to start learning
Reading is open to everyone. Enrolling is free, and it is what unlocks the audio lessons, practice tests and progress tracking.
27.2.2. Complexity Analysis
This section
Practice test
12 questions on this section. Wrong answers show you what to read again.
Sign up to take itWhole chapter
Revision test
Mixed questions from across the chapter. Your answers get marked.
Sign up to take itQuick
Flashcard drill
3 cards from this lesson. Good the night before a test.
Try these first
- 1.
What is the first step in Dijkstra's algorithm?
Hint
Think about how we initialize the distances.
- 2.
What data structure is inefficient for Dijkstra's algorithm?
Hint
Consider how we store graph data and access the vertices.
- 3.
What is the correct time complexity of Dijkstra's algorithm using an adjacency matrix?
- O(n)
- O(n log n)
- O(n^2)
Hint
Think about the loops involved in finding the minimum distance.
- 4.
True or False: Dijkstra's algorithm can correctly determine shortest paths in a graph with negative weight edges.
- True
- False
Hint
Recall the assumptions made by Dijkstra's algorithm.
- 5.
Given a graph with the following weights, perform Dijkstra's algorithm from vertex A. Show all steps and final shortest paths.
Hint
Keep track of distances from A, marking each burnt vertex.
- 6.
Explain how Dijkstra's algorithm would perform on a complete graph with negative edge weights, detailing any deviations from the expected outcome.
Hint
Consider the implications of a negative cycle.
Exercises
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting
4 more questions available
Enrol freeQuiz
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting
2 more questions available
Enrol freeChallenge Problems
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting