I n i j 2 2 1 1 n i i n i n 1 2 2 1 10 5 6 1 5 10 1 k

  • No School
  • AA 1
  • 17

This preview shows page 10 - 16 out of 17 pages.

i n i j 2 ) 2 )( 1 ( 1 n i i n i n 1 2 ) 2 )( 1 ( 10 5 6 1 5 10 1 k N i N N i 1 2 ) 1 (
Image of page 10
A MAXIMUM SUB SEQUENCE SUM PROBLEM Solve the summation = c 1 n 3 + c 2 n 2 + c 3 n If n = 1000, Time constant = 1msec => T 10 9 /(24*1000*60*60 ) 11 days
Image of page 11
A MAXIMUM SUB SEQUENCE SUM PROBLEM Not feasible for large inputs Try to identify the inefficiencies in the algorithm and see if we can find some feasible algorithm Go back to the example
Image of page 12
A MAXIMUM SUB SEQUENCE SUM PROBLEM To compute all the sub-sequence starting from a point i, we don’t have to come back again and again. The last line in the diagram contains all the subsequence starting from the same point. M.S.S.S() { Max-sum = 0; for(i = 0; i < N; i++) { this-sum = 0; for(j = i; j < N; j++) { this-sum = this-sum + Array[j]; if(this-sum > Max-Sum) Max-Sum = this-sum } } return Max-Sum; }
Image of page 13
A MAXIMUM SUB SEQUENCE SUM PROBLEM An 2 + Bn + C if n = 1000 time constant = 1msec => T = 10 6 /(1000*60*60) = 10 3 /(60*60) 0.27 Hours 16 minutes
Image of page 14
A MAXIMUM SUB SEQUENCE SUM PROBLEM Again Not feasible for very large inputs Try to identify the inefficiencies in the algorithm and see if we can find some feasible algorithm If not, then we may have to think in a different way with a different approach
Image of page 15
Image of page 16

You've reached the end of your free preview.

Want to read all 17 pages?

  • Fall '19

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors