Presentation is loading. Please wait.

Presentation is loading. Please wait.

Algorithms for the Maximum Subarray Problem Based on Matrix Multiplication Authours : Hisao Tamaki & Takeshi Tokuyama Speaker : Rung-Ren Lin.

Similar presentations


Presentation on theme: "Algorithms for the Maximum Subarray Problem Based on Matrix Multiplication Authours : Hisao Tamaki & Takeshi Tokuyama Speaker : Rung-Ren Lin."— Presentation transcript:

1 Algorithms for the Maximum Subarray Problem Based on Matrix Multiplication Authours : Hisao Tamaki & Takeshi Tokuyama Speaker : Rung-Ren Lin

2 Outline  Introduction  ½ -approximation  Funny matrix multiplication  Reduction  Two little programs

3  Introduction  ½ -approximation  Funny matrix multiplication  Reduction  Two little programs

4 Definition  Given an m by n matrix, output the maximum subarray.

5 History  Bentley proposes this problem in 1984.  Kadane ’ s algorithm solves 1-D problem in linear time.  Kadane ’ s idea does not work for the 2-D case.  There ’ s an O(m 2 n) algorithm by using Kadane ’ s idea.

6 Kadane’s algorithm S(i) = A(i) + max{S(i-1), 0} i

7 Preprocessing  Given a matrix A[1 … m][1 … n], we can compute B[1 … m][1 … n] in O(mn) time such that B[i][j] represents the sum of A[1 … i][1 … j].

8  Introduction  ½ -approximation  Funny matrix multiplication  Reduction  Two little programs

9 n m Time = mn/2 * 2 = mn

10 n m Time = mn/4 * 4= mn

11 Time Complexity  O(mn*logm)

12  Introduction  ½ -approximation  Funny matrix multiplication  Reduction  Two little programs

13 Definition  Given two n by n matrices, A ij & B ij C ij = max k=1 to n {A ik + B kj } C ij = max k=1 to n {A ik + B kj } ABC jj ii

14 History  Funny matrix multiplication is well- studied, since its computational complexity is known to be equivalent to that of “ all-pairs shortest paths ”.  Fredman constructs a subcubic algorithm with running time :

15 Cont’d  Takaoka improved to in 1992. in 1992.

16  Introduction  ½ -approximation  Funny matrix multiplication  Reduction  Two little programs

17 Definition  T(m, n) : computing time for the m by n matrix  T row (m, n) : row-centered  T col (m, n) : column-centered T(m, n) = T row (m, n) + T col (m, n) + T(m, n) = T row (m, n) + T col (m, n) + 4T(m/2, n/2) 4T(m/2, n/2)

18 Cont’d  T center (m, n) : row & column-centered T row (m, n) = T center (m, n) + 2T row (m, n/2) T col (m, n) = T center (m, n) + 2T col (m/2, n)

19 Reduction A B CD

20 Cont’d  Let A, B, C, D[1 … m/2][1 … n/2] be the sum of the given area. X ij = max k=1 to m/2 {A ik + C jk } X ij = max k=1 to m/2 {A ik + C jk } Y ij = max k=1 to m/2 {B ik + D jk } Y ij = max k=1 to m/2 {B ik + D jk } output = max{X ij + Y ij } output = max{X ij + Y ij }

21  Introduction  ½ -approximation  Funny matrix multiplication  Reduction  Two little programs

22 13-card

23 Pacman

24 Challenges  It ’ s difficult to search 3-D models.

25

26 The End


Download ppt "Algorithms for the Maximum Subarray Problem Based on Matrix Multiplication Authours : Hisao Tamaki & Takeshi Tokuyama Speaker : Rung-Ren Lin."

Similar presentations


Ads by Google