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
Complete the sentence. <br><br> ____ Is the study and use of very small technology units
kondor19780726 [428]

Answer:

nanotechnology

Explanation:

I just took the test

3 0
4 years ago
The guy wire BD exerts on the telephone pole AC a force P directed along BD. Knowing that P must have a 720-N component perpendi
AysviL [449]

Answer:

Explanation:

  • From the diagram, tanФ = opp/Adj = 2.4m/7m
  • tanФ = 0.3429. Ф = arctan ( 0.3429 )
  • Therefore, Ф = 18.92°

Given force perpendicular to AC from the diagram = 720N

  • Resolving vertically; PsinФ = 720

a) P = 720/sin18.92° = 2220N = the magnitude of the force P

b) To get component along line AC;

  • resolving horizontally, component along AC = PcosФ
  • = 2220 x cos 18.92° = 2100N

8 0
4 years ago
The ret instruction (without operands) will pop how many bytes off the stack?
Archy [21]
<span>Using the RET instruction without operands will pop 4 bytes off the stack. RET is part of the x86 instruction set and stands for “return from procedure”. A stack is part of memory that is allocated to store items. Popping bytes from a stack is the same thing is removing items from the data structure in memory.</span>
4 0
4 years ago
Design a base class, Road, with the following members:
hichkok12 [17]

I've attached my Java implementation.

Download java
<span class="sg-text sg-text--link sg-text--bold sg-text--link-disabled sg-text--blue-dark"> java </span>
<span class="sg-text sg-text--link sg-text--bold sg-text--link-disabled sg-text--blue-dark"> java </span>
6 0
3 years ago
A bag of cookies holds 40 cookies. The calorie information on the bag claims that there are 10 servings in the bag and that a se
laila [671]

Answer:

import java.util.Scanner;

public class ANot {

   public static void main(String[] args) {

   Scanner in = new Scanner (System.in);

       System.out.println("How many cookies did you eat today");

       int numOfCookies = in.nextInt();

       double numCalories = (numOfCookies*300)/4;

       System.out.println("The total number of calories you consumed in "+numOfCookies+" cookies is " +

               " "+numCalories);

   }

}

Explanation:

This code is implemented in Java.

  1. We know from the question that 4 cookies contain 300 calories
  2. Therefore number of calories consumed = (number of cookies eaten*300)/4
  3. To implement this in java we used the scanner class to prompt user for the input
  4. save the input to a variable and write mathematical expression for the number of calories consumed
  5. Then output the result

4 0
3 years ago
Other questions:
  • Suppose a computer has 16-bit instructions. The instruction set consists of 32 different operations. All instructions have an op
    7·1 answer
  • _____ is a technique that combines the strongest features of Wired Equivalent Privacy (WEP) and Extensible Authentication Protoc
    11·1 answer
  • Given the lists list1 and list2 that are of the same length, create a new list consisting of the last element of list1 followed
    13·1 answer
  • The mathematical order of operations is used in Excel when formulas are evaluated. This order of operations states the order to
    14·2 answers
  • Give two differences between a source and an object program​
    10·1 answer
  • Declare an array named tax rates of five elements of type double and initialize the elements (starting with the first) to the va
    12·1 answer
  • Which of the following best describes the displayport interface used for connecting video monitors to computers
    11·1 answer
  • WHO SAYS BUP ALL THE TIME ​
    8·1 answer
  • Need help ASAP <br><br> Thankss + BRAINLIST only for correct answers
    11·1 answer
  • In the computing environment the numerical value represented by the pre-fixes kilo-, mega-, giga-, and so on can vary depending
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!