# 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 ( 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 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 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; } 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 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  #### You've reached the end of your free preview.

Want to read all 17 pages?

• Fall '19

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern  