Uploaded by ren_ds

Divide and Conquer

advertisement
What is the Divide And Conquer Approach? Give An Example
The Divide and Conquer approach divides the problem into subproblems, solves the
subproblems, and then combines the solutions of the subproblems to get the solution for the
entire problem. Binary search is an example of the divide and conquer approach.
What is the difference between divide-and-conquer and dynamic programming?
In dynamic programming, the subproblems overlap, so each sub-problem is only solved once.
The results of the subproblems are stored, so they won’t be solved again.
Can you design an algorithm for finding the minimum element in a list using
divide-and-conquer? What is the complexity of this algorithm?
Yes, an algorithm can be designed for finding the minimum element in a list. Its complexity
would be O(n^2).
What is backtracking? Give an example.
Backtracking searches for a candidate solution incrementally, leaving the option after it
determines whether it is a valid solution or not, and then looks for a new candidate. An example
of backtracking would be crossword puzzles or sudoku.
Describe Graham's algorithm for finding a convex hull. Why does the algorithm use a
stack to store the points in a convex hull?
Graham’s algorithm finds all vertices of the convex hull along its boundary and uses a stack to
detect and remove concavities in the boundary.
Professor Diogenes has n supposedly identical integrated-circuit chips that in principal are
capable of testing each other. The professor’s test jig accommodates two chips at a time.
When the jig is loaded, each chip tests the other and reports whether it is good or bad. A
good chip always reports accurately whether the other chip is good or bad, but the
professor cannot trust the answer of a bad chip.
Create a list with all the chips and apply the divide and conquer algorithm to compare the chips
between good vs bad. After, compare the good chips with themselves and check if they are good
or bad.
Download