0% found this document useful (0 votes)
218 views

Advanced Algorithms Quiz 3

Floyd Warshall's algorithm is used to solve all-pairs shortest path problems in directed graphs. It uses dynamic programming to efficiently solve this problem by breaking it down into overlapping subproblems. The key properties that make dynamic programming applicable are optimal substructure and overlapping subproblems - optimal solutions can be constructed from optimal solutions to subproblems, and subproblems are solved repeatedly.

Uploaded by

mathu
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
218 views

Advanced Algorithms Quiz 3

Floyd Warshall's algorithm is used to solve all-pairs shortest path problems in directed graphs. It uses dynamic programming to efficiently solve this problem by breaking it down into overlapping subproblems. The key properties that make dynamic programming applicable are optimal substructure and overlapping subproblems - optimal solutions can be constructed from optimal solutions to subproblems, and subproblems are solved repeatedly.

Uploaded by

mathu
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1. Floyd Warshall's Algorithm is used for solving .

a) All pair shortest path problems


b) Single Source shortest path problems
c) Network flow problems
d) Sorting problems
Ans: a

2. Floyd Warshall's Algorithm can be applied on .....


A Undirected and unweighted graphs
B Undirected graphs
C. Directed graphs
D Acyclic graphs
Ans: c

3. What approach is being followed in Floyd Warshall Algorithm?


A. Greedy technique
B. Dynamic Programming
C. Linear Programming
D. Backtracking
Ans: B

4. What happens when the value of k is 0 in the Floyd Warshall Algorithm?


A. 1 intermediate vertex
B. 0 intermediate vertex
C. N intermediate vertices
D. N-1 intermediate vertices

Ans b

5. Which of the following is/are property/properties of a dynamic programming problem?


a) Optimal substructure
b) Overlapping subproblems
c) Greedy approach
d) Both optimal substructure and overlapping subproblems

Ans: d

6. If an optimal solution can be created for a problem by constructing optimal solutions for its
subproblems, the problem possesses ____________ property.
a) Overlapping subproblems
b) Optimal substructure
c) Memoization
d) Greedy

Ans: b
7. If a problem can be broken into subproblems which are reused several times, the problem
possesses ____________ property.
a) Overlapping subproblems
b) Optimal substructure
c) Memoization
d) Greedy

Ans: (a)

8. When dynamic programming is applied to a problem, it takes far less time as compared to
other methods that don’t take advantage of overlapping subproblems.
a) True
b) False

ANS: A

9. The approach of dynamic programming is similar to

A. Parsing
B. Hash table
C. Divide and Conquer algorithm
D. Greedy algorithm

Ans. C

10. Quick sort algorithm is an example of


a. Greedy approach
b. Improved binary search
c. Dynamic Programming
d. Divide and conquer

Ans. d

You might also like