• 沒有找到結果。

# Do We Teach the Right Algo rithm Design Techniques ?

N/A
N/A
Protected

Share "Do We Teach the Right Algo rithm Design Techniques ?"

Copied!
22
0
0

(1)

## Do We Teach the Right Algorithm Design Techniques ?

(2)

(3)

(4)

### However, this widely accepted taxonomy has ser ious shortcoming.

First, it includes techniques of different level s of generality. For example, it seems obvious t hat divide-and-conquer is more general than gree dy approach and branch-and-bound.

Second, it fails to distinguish divide-and-conqu er and decrease-and-conquer.

Third, it fails to include brute force and tran sform-and-conquer.

(5)

### Introduction-3

Fourth, its linear, as opposed to hierarchical, structure fails to reflect important special cas es of techniques.

Finally, it fails to classify many classical alg orithms (e.g., Euclid’s algorithm, heapsort, se arch trees, hashing, etc.)

(6)

### Brute Force

It usually based on the problem’s statement and definitions of concepts involved

This technique can not be overlooked by the follo wing reasons

Applicable to a very wide variety of problems, e.g., c omputing the sum of n numbers, adding two matrices ...

Useful for solving small-size instances of a problem

Serving an important theoretical or educational purpos e, e.g., NP-hard problem, as a yardstick for more effi cient alternatives for solving a problem

(7)

### Divide-and-conquer

It based on partitioning a problem into a number o f smaller subproblems, usually of the same kind an d ideally of about the same size

The subproblems are then solved and their solution s combined to get a solution to the original probl em.

Divide-before-processing: the bulk of the work is done while combining solutions to smaller subproblems, e.g., mergesort.

Process-before-dividing: processing before a partition into subproblems, e.g., quicksort.

(8)

### Decrease-and-conquer

This technique is solving a problem by reducing its instance to a smaller one, solving the latte r, and then extending the obtained solution to g et a solution to the original instance

decrease by a constant: insertion sort

decrease by a constant factor(a.k.a. prune-and-searc h): binary search

variable size decrease: Euclid’s algorithm

(9)

### Transform-and-conquer

This technique is based on the idea of transform ation

simplification: solves a problem by first transformin g its instance to another instance of the same proble m which makes the problem easier to solve, e.g., Gaus sian elimination, heapsort ...

representation change: it is based on a transformatio n of a problem’s input to a different representation , e.g., hashing, heapsort …

(10)

### Four General Design Techniques-4 cont.

preprossing: The idea is to process a part of the inp ut or the entire input to get some auxiliary informat ion which speeds up solving the problem, e.g., KMP al gorithms.

reduction: An instance of a problem is transformed to an instance of a different problem altogether, e.g, N P-hard problems.

(11)

(12)

### A Test of Generality-2

Sorting Searching

Brute force Selection sort Sequential search Divide-and-conquer Mergesort Applicable

Decrease-and- conquer

Insertion sort Applicable Transform-and-

conquer Heapsort Search trees, hashing

The others - greedy approach, dynamic

programming, backtracking, and branch-and-bound - fail to qualify as the most general design techniques.

(13)

### Local search techniques

Greedy methods: it builds solutions piece by pie ce … the choice selected is that which produces the largest immediate gain while maintaining fea sibility, e.g., Prim’s algorithm.

Iterative methods: it start with any feasible so lution and proceed to improve upon the solution by repeated applications of a simple step, e.g., Ford-Fulkerson algorithm.

(14)

### Dynamic programming

Bottom-up: a table of solutions to subproblems i s filled starting with the problem’s smallest s ubproblems. A solution to the original instance of the problem is then obtained from the table c onstructed.

Top-down: memory function

(15)

### State-space-tree techniques

Backtracking: take coloring problem as an exampl e:

1 2

4 3

Use three colors to color the

vertices of this graph. How many different ways ?

(16)

S

1 2 3

2

1 3

2

1 3

V1

V2

V3

(17)

### Further Refinements-3 cont.

Branch-and-Bound: take TSP problem as an example . If there are four cities, all feasible solutio ns are

(18)

### Further Refinements-3 cont.

Consider the traveling costs between any two cit ies:

=3+3+5+4+1

(19)

Start to branch

Choose 12

(20)

### Further Refinements-3 cont.

The current branch:

(21)

(22)

### Conclusion

This paper gives a new taxonomy of algorithm design tech niques.

No matter how many general design techniques are recogni zed, there will always be algorithms that cannot be natu rally interpreted as an application of those techniques.

Some algorithms can be interpreted as an application of different techniques, e.g., selection sort, as a brute-f orce algorithm and as a decrease-and-conquer method.

Some algorithms may incorporate ideas of several techniq ues, e.g. Fourier transform takes advantage of both the transform and divide-and-conquer ideas.

In Section 3, the shift and scale argument from [2] is applied to show how each quantitative Landis theorem follows from the corresponding order-of-vanishing estimate.. A number

One of the main results is the bound on the vanishing order of a nontrivial solution to the Stokes system, which is a quantitative version of the strong unique continuation prop-

 Promote project learning, mathematical modeling, and problem-based learning to strengthen the ability to integrate and apply knowledge and skills, and make. calculated

In this paper, we extended the entropy-like proximal algo- rithm proposed by Eggermont [12] for convex programming subject to nonnegative constraints and proposed a class of

This kind of algorithm has also been a powerful tool for solving many other optimization problems, including symmetric cone complementarity problems [15, 16, 20–22], symmetric

Moreover, for the merit functions induced by them for the second- order cone complementarity problem (SOCCP), we provide a condition for each sta- tionary point to be a solution of

 Definition: A problem exhibits  optimal substructure if an ..

 Combining an optimal solution to the subproblem via greedy can arrive an optimal solution to the original problem. Prove that there is always an optimal solution to the