1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
swat32
3 years ago
11

Objective:This assignment is designed to give you experience with thinking about algorithm analysis and performanceevaluation.Pr

oject 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.
Computers and Technology
1 answer:
wolverine [178]3 years ago
7 0

Answer:

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;

}

You might be interested in
Suppose a worker needs to process 100 items. the time to process each item is exponentially distributed with a mean of 2 minutes
stiks02 [169]
Suppose a worker nneeds to process100 items
7 0
3 years ago
A ____ is a program that is installed without the permission or knowledge of the computer user, that is designed to alter the wa
g100num [7]
That would be a virus.
8 0
3 years ago
Consider the following sequence, defined from n=2 to 15 (inclusive). Pn=n2−1. Produce a list named primes which only contains va
omeli [17]

Answer:

primes = []

for n in range(2,16):

   pn = n*n - 1

   if is_prime(pn):

       primes.append(pn)

5 0
3 years ago
We cannot imagine a life without the Internet. Imagine that you had to live without being connected to the Internet. Discuss the
sleet_krkn [62]

Answer:

1, I would not be able to contact anyone, or call for help.

2, Stores like Apple would lose their purpose.

3, Life would be boring and dull.

  • i hope that helped at all.

4 0
2 years ago
What target audience does your product serve?
Natasha_Volkova [10]

Answer:

A target audience is the demographic of people most likely to be interested in your product or service. For example if you own a plumbing company, the target audience is property owners, both commercial and residential.

7 0
3 years ago
Other questions:
  • Once you have selected the range of cells for your table data, from which tab can you open the Insert Table dialog box?
    6·2 answers
  • When u look at a green object through red glass the object will appear
    11·2 answers
  • What is the point of brainy when other people have to answer your questions but not the cumputer
    9·1 answer
  • ________ are chunks of software - installed on one's computer, tablet, or smartphone - that are gateways to games, online resour
    8·1 answer
  • . A store offers a deposit of 6% on the cash price of $462. The deposit amount is?​
    6·1 answer
  • Interest on loan paid to sangam stores Rs5000(journal entry)​
    13·1 answer
  • Where are 'if' and 'else' statements shown when printing a document in a word processor?
    8·1 answer
  • The following code appears in a sort function. Will this function sort in increasing order (smallest first) or decreasing order
    5·1 answer
  • Kenny is asked to submit a photo for the annual photographic competition. He decided to capture a photo with the light-painting
    15·1 answer
  • How do people and computers approach problems differently
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!