SlideShare a Scribd company logo
HINT: For i = 1 , . . . ,n, let S[i] be the max sum ending with A[i] while allowing size-1 gaps.
Derive a recurrence for S[i] Problem 4. Max sum with 1-gaps Given a length- n array of integers
A[1n], we would like to find maximum sum which could be obtained by adding elements in a
subsequence of A if we are allowed to start anywhere in A but once we start, we can either take
the element after the previously selected element or the one after, i.e, gaps of length at most 1 are
allowed in the subsequence. More formally, given A find the maximum S such that there is an
integer 0mn and indices 1i1<

More Related Content

More from arkmuzikllc

im solving tha m-puzzel sliding tail problem where m = n^2 - 1 I ha.pdf
im solving tha m-puzzel sliding tail problem where m = n^2 - 1 I ha.pdfim solving tha m-puzzel sliding tail problem where m = n^2 - 1 I ha.pdf
im solving tha m-puzzel sliding tail problem where m = n^2 - 1 I ha.pdf
arkmuzikllc
 
Im creating a skip list program for my Algorithms and Advanced Data.pdf
Im creating a skip list program for my Algorithms and Advanced Data.pdfIm creating a skip list program for my Algorithms and Advanced Data.pdf
Im creating a skip list program for my Algorithms and Advanced Data.pdf
arkmuzikllc
 
if any additional information is required let me know Work through t.pdf
if any additional information is required let me know Work through t.pdfif any additional information is required let me know Work through t.pdf
if any additional information is required let me know Work through t.pdf
arkmuzikllc
 
I need help with providing a 2 page overview of the case study provi.pdf
I need help with providing a 2 page overview of the case study provi.pdfI need help with providing a 2 page overview of the case study provi.pdf
I need help with providing a 2 page overview of the case study provi.pdf
arkmuzikllc
 
I keep getting NullPointerExcepetion, can someone help me with spinL.pdf
I keep getting NullPointerExcepetion, can someone help me with spinL.pdfI keep getting NullPointerExcepetion, can someone help me with spinL.pdf
I keep getting NullPointerExcepetion, can someone help me with spinL.pdf
arkmuzikllc
 
I have been tasked to write a code for a Singly Linked list that inc.pdf
I have been tasked to write a code for a Singly Linked list that inc.pdfI have been tasked to write a code for a Singly Linked list that inc.pdf
I have been tasked to write a code for a Singly Linked list that inc.pdf
arkmuzikllc
 
I am trying to pass a date to a function in postgres.My function w.pdf
I am trying to pass a date to a function in postgres.My function w.pdfI am trying to pass a date to a function in postgres.My function w.pdf
I am trying to pass a date to a function in postgres.My function w.pdf
arkmuzikllc
 
How can an event such as the terrorist attacks of September 2001 aff.pdf
How can an event such as the terrorist attacks of September 2001 aff.pdfHow can an event such as the terrorist attacks of September 2001 aff.pdf
How can an event such as the terrorist attacks of September 2001 aff.pdf
arkmuzikllc
 

More from arkmuzikllc (10)

import React, { useEffect } from react;import { BrowserRouter as.pdf
import React, { useEffect } from react;import { BrowserRouter as.pdfimport React, { useEffect } from react;import { BrowserRouter as.pdf
import React, { useEffect } from react;import { BrowserRouter as.pdf
 
im solving tha m-puzzel sliding tail problem where m = n^2 - 1 I ha.pdf
im solving tha m-puzzel sliding tail problem where m = n^2 - 1 I ha.pdfim solving tha m-puzzel sliding tail problem where m = n^2 - 1 I ha.pdf
im solving tha m-puzzel sliding tail problem where m = n^2 - 1 I ha.pdf
 
Im creating a skip list program for my Algorithms and Advanced Data.pdf
Im creating a skip list program for my Algorithms and Advanced Data.pdfIm creating a skip list program for my Algorithms and Advanced Data.pdf
Im creating a skip list program for my Algorithms and Advanced Data.pdf
 
if any additional information is required let me know Work through t.pdf
if any additional information is required let me know Work through t.pdfif any additional information is required let me know Work through t.pdf
if any additional information is required let me know Work through t.pdf
 
I need help with providing a 2 page overview of the case study provi.pdf
I need help with providing a 2 page overview of the case study provi.pdfI need help with providing a 2 page overview of the case study provi.pdf
I need help with providing a 2 page overview of the case study provi.pdf
 
I keep getting NullPointerExcepetion, can someone help me with spinL.pdf
I keep getting NullPointerExcepetion, can someone help me with spinL.pdfI keep getting NullPointerExcepetion, can someone help me with spinL.pdf
I keep getting NullPointerExcepetion, can someone help me with spinL.pdf
 
I have been tasked to write a code for a Singly Linked list that inc.pdf
I have been tasked to write a code for a Singly Linked list that inc.pdfI have been tasked to write a code for a Singly Linked list that inc.pdf
I have been tasked to write a code for a Singly Linked list that inc.pdf
 
I am trying to pass a date to a function in postgres.My function w.pdf
I am trying to pass a date to a function in postgres.My function w.pdfI am trying to pass a date to a function in postgres.My function w.pdf
I am trying to pass a date to a function in postgres.My function w.pdf
 
How can an event such as the terrorist attacks of September 2001 aff.pdf
How can an event such as the terrorist attacks of September 2001 aff.pdfHow can an event such as the terrorist attacks of September 2001 aff.pdf
How can an event such as the terrorist attacks of September 2001 aff.pdf
 
Hey! Could I possibly get some help with this Its a little confusi.pdf
Hey! Could I possibly get some help with this Its a little confusi.pdfHey! Could I possibly get some help with this Its a little confusi.pdf
Hey! Could I possibly get some help with this Its a little confusi.pdf
 

Recently uploaded

Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
Avinash Rai
 
plant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated cropsplant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated crops
parmarsneha2
 

Recently uploaded (20)

NLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptxNLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptx
 
NCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdfNCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdf
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
plant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated cropsplant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated crops
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resources
 
Salient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxSalient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptx
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 

HINT For i = 1 , . . . ,n, let S[i] be the max sum ending with A[i].pdf

  • 1. HINT: For i = 1 , . . . ,n, let S[i] be the max sum ending with A[i] while allowing size-1 gaps. Derive a recurrence for S[i] Problem 4. Max sum with 1-gaps Given a length- n array of integers A[1n], we would like to find maximum sum which could be obtained by adding elements in a subsequence of A if we are allowed to start anywhere in A but once we start, we can either take the element after the previously selected element or the one after, i.e, gaps of length at most 1 are allowed in the subsequence. More formally, given A find the maximum S such that there is an integer 0mn and indices 1i1<