subject

Objective:This assignment is designed to give you experience with thinking about algorithm analysis and performanceevaluation. Project DescriptionYou will analyze three algorithms to solve the maximum contiguous subsequence sum problem, and then evaluate the performance of instructor-supplied implementations of those three algorithms. You will compare your theoretical results to your actual results in a written report. What is the maximum contiguous subsequence sum problem?Given a sequence of integers A1, A2 ... An (where the integers may be positive or negative), find a subsequence Aj, ..., Ak that has the maximum value of all possible subsequences. The maximum contiguous subsequence sum is defined to be zero if all of the integers in the sequence are negative.

Answers

ansver
Answer from: sarah02152005

Check the explanation

Explanation:

#include<stdio.h>

/*Function to return max sum such that no two elements

are adjacent */

int FindMaxSum(int arr[], int n)

{

 int incl = arr[0];

 int excl = 0;

 int excl_new;

 int i;

 for (i = 1; i < n; i++)

 {

    /* current max excluding i */

    excl_new = (incl > excl)? incl: excl;

    /* current max including i */

    incl = excl + arr[i];

    excl = excl_new;

 }

  /* return max of incl and excl */

  return ((incl > excl)? incl : excl);

}

/* Driver program to test above function */

int main()

{

 int arr[] = {5, 5, 10, 100, 10, 5};

 printf("%d \n", FindMaxSum(arr, 6));

 getchar();

 return 0;

}

ansver
Answer from: Quest

answer

it would be true.

ansver
Answer from: Quest

i think it is a female.

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 20:00, Jana1517
What is the worst-case complexity of the maxrepeats function? assume that the longest string in the names array is at most 25 characters wide (i. e., string comparison can be treated as o( class namecounter { private: int* counts; int nc; string* names; int nn; public: namecounter (int ncounts, int nnames); int maxrepeats() const; }; int namecounter: : maxrepeats () { int maxcount = 0; for (int i = 0; i < nc; ++i) { int count = 1; for (int j = i+1; j < nc; ++j) { if (names[i] == names[j]) ++count; } maxcount = max(count, maxcount); } return maxcount; }
Answers: 3
image
Computers and Technology, 22.06.2019 23:30, riah133
Creating "smart interfaces" in all sectors of industry, government, and the public arena is one of the fastest growing hct areas. these interfaces model, interpret, and analyze such human characteristics as speech, gesture, and vision. the field of biometrics, in which humans authenticate themselves to machines, is an area of considerable interest to hct practitioners. fingerprint scans are one of the most frequently used biometric options, and this article, biometric student identification: practical solutions for accountability & security in schools, makes a case for the implementation of fingerprint scans in schools. critique the article, and answer the following questions: according to the author, what are the main benefits of adopting fingerprint scans in schools for student identification? according to the author, what are the main drawbacks of adopting fingerprint scans in schools for student identification? do you agree with the author's assessment of the pl
Answers: 2
image
Computers and Technology, 24.06.2019 05:30, roderickhinton
Someone plzz me which of these defines a social search? a. asking a search engine a question that is answered by a real person on the other sideb. modifying search results based on popularity of a web pagec. modifying search results based on a ranking of a web page
Answers: 2
image
Computers and Technology, 24.06.2019 08:30, ladybuggirl400
@josethesolis i need can anyone text me and follow me
Answers: 1
You know the right answer?
Objective:This assignment is designed to give you experience with thinking about algorithm analysis...