Test Review Flashcards
A breadth-first search algorithm uses a :
QUEUE
The worse case asympotitc complexity of Dijkstra’s algorithm in a dense graph is :
O(V^2)
If an undirected graph has the same weight for every edge, then both the single-source shortest path problem and the minimal spanning tree problem for the graph can be solved in:
Linear Time
TRUE or FALSE
The greedy algorithm for the fractional knapsack problem takes a fractional amount of at most one item.
TRUE
Prim’s Algorithm can work with
Positive and Negative Weights.
TRUE or FALSE
All dynamic programming algorithms have the same asympotitc complexity.
FALSE.
Bellman Ford: O(V*E)
Dijkstra’s: O(E log V)
If a depth-first traversal of a directed graph yeilds no back edges,
Then the graph is acyclic
When a priority queue is implemented using a binary heap data structure, what is the complexity of insertion and removal:
Insertion: O(log n)
Removal: O(log n)
When a priority queue is implemented using a simple array, what is the complexity of insertion and removal:
Insertion: O(1)
Removal: O(n)
Name a graph algorithm for which the implementation of a priority queue as a binary heap is best when the graph is sparse, but implementation of priority queue as a simple array is best when the graph is dense.
Dijkstra’s
Prim’s Minimal Spanning
Most efficient algoirthm for Single-source shortest path problem in an unweighted graph.
Breadth-First Search
O(V+E)
Most efficient algorithm for Single-source shortest problem path in a graph with non-negative edge weights.
Dijkstra’s Algorithm.
O(V log V) In Sparse.
Most efficient algorithm for single-source shorest path problem in a graph with negative wegiths but no negative-weight cycles.
Bellmann Ford
O(V*E) In Sparse.
What is the asympotitc complexity of the fastest algorithm for finding the strongly-connected components of a directed graph.
DFS: O(V+E)
What is the asymptotic complexity of the Bellman-Ford algorithm as a function of the size of the graph G = (V,E)?
O(V*E)