Presentation is loading. Please wait.

Presentation is loading. Please wait.

Efficient heuristic algorithms for the maximum subarray problem Rung-Ren Lin and Kun-Mao Chao.

Similar presentations


Presentation on theme: "Efficient heuristic algorithms for the maximum subarray problem Rung-Ren Lin and Kun-Mao Chao."— Presentation transcript:

1 Efficient heuristic algorithms for the maximum subarray problem Rung-Ren Lin and Kun-Mao Chao

2 Preview  Trying to guess the answer intelligently.  Preliminary experiments show that these approaches are very promising for locating the maximum subarray in a given two- dimensional array.

3 Review of Maximum Subarray  Bentley posed the maximum subarray problem in his book “Programming Pearls” in 1984.  He introduces Kadane's algorithm for the one-dimensional case, whose time is linear.

4 Cont’d  Given an m × n array of numbers, Bentley solved the problem in O(m 2 n) time.  An improvement O(m 2 n(loglogm/logm) 0.5 ) was given by Tamaki et al. in 1998. This algorithm is heavily recursive and complicated.

5 Applications 202530354045505560 $ $$ $$$ $$$$ $$$$$ $$$$$$ $$$$$$$

6 Cont’d

7 Heuristic Methods  Given a 2-D array A[1..m][1..n], let TL[i][j] denote the sum of the rectangle A[1..i][1..j]. -312 20 0-21 -3-20 1 -30 ATL

8 Constructing TL Matrix  for i = 2 to n do for j = 1 to n do A[i][j] = A[i][j] + A[i-1][j] -312 20 0-21 -32 02 -23 A A ’

9 Cont’d  for i = 2 to n do for j = 1 to n do A’[j][i] = A’[j][i] + A’[j][i-1] -312 02 -23 -3-20 1 -30 A’A’ TL

10 Computing an Arbitrary Rectangle

11 How to guess ?  Each rectangle can be computed by TL matrix, and the answer is MAX( + - - ).  the larger the better.  the smaller the better.

12 Cont’d  We try only those entries which are in the top k-th, or in the bottom k- th for a given k.  We test only O(k) times instead of O(n) times. Since there are in total O(m 2 ) pairs, this step takes O(km 2 ).

13 4-Corner

14 Happy New Year!!

15 Interesting Questions  128 gold.  The way to heaven and hell.  10 smart prisoners.


Download ppt "Efficient heuristic algorithms for the maximum subarray problem Rung-Ren Lin and Kun-Mao Chao."

Similar presentations


Ads by Google