Topological sorting arranges vertices of a directed graph in such a way that for every directed edge from vertex u to vertex v, vertex u appears _______ vertex v in the ordering.
- Adjacent to
- After
- Before
- Parallel to
In topological sorting, for every directed edge from vertex u to vertex v, vertex u appears before vertex v in the ordering. This ensures that there is a consistent order of execution for tasks or dependencies.
Explain how you would modify the coin change problem to find the total number of possible combinations instead of the minimum number of coins.
- Adjust the objective to maximize the number of coins used.
- Change the coin denominations to larger values.
- Modify the base case to return the total number of combinations.
- No modification is needed; the original problem already provides this information.
To find the total number of possible combinations, modify the base case of the dynamic programming solution for the coin change problem. Instead of returning the minimum number of coins, adjust it to return the total number of combinations that make up the target amount.
Recursive implementation of binary search involves breaking the problem into _______ subproblems until a solution is found.
- Five
- Four
- Three
- Two
Recursive implementation of binary search involves breaking the problem into two subproblems at each step, making it a logarithmic algorithm with a time complexity of O(log n), where 'n' is the number of elements.