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
2 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]2 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
You're an administrator for a large corporation and you are responsible for deploying computers often and quickly. What server d
fomenos

Answer: it used the keyboard and apps

6 0
3 years ago
In the ADT graph the methid addVertex has efficiency
sweet-ann [11.9K]

Answer:

In ADT graph the efficiency of addVertex has efficiency O(logn).

Explanation:

The time complexity of the method addvertex in ADT graph is O(logn). addVertex method has time complexity of O(logn) because it has to divide the list in half and add the vertex according to the place where the needs to be added.

hence we conclude that the answer is O(logn).

6 0
2 years ago
Define a method printFeetInchShort, with int parameters numFeet and numInches, that prints using ' and " shorthand. End with a n
worty [1.4K]

Answer:

The program to this question as follows:

Program:

//header file

#include <iostream> //defining header file

using namespace std;

void printFeetInchShort(int numFeet,int numInches); //decalring method printFeetInchShort  

void printFeetInchShort(int numFeet,int numInches)//defining method printFeetInchShort

{

cout<<"height: "; // print message

cout<<numFeet<<"\'"<<""<<numInches<<"\""; //print value

}

int main() //defining main method

{

int numFeet, numInches; //defining integer variable

cout<<"Enter height feet: "; //print message

cin>>numFeet; //input value by user

cout<<"Enter height inches: "; //print message

cin>>numInches; //input value by user

printFeetInchShort(numFeet,numInches); //calling method printFeetInchShort    

return 0;

}

Output:

Enter height feet: 5

Enter height inches: 9

height: 5'9"

Explanation:

In the above C++ language program, first, a header file is included, that uses the basic function, in the next step, the "printFeetInchShort()" method is defined, in the method two integer variables passed as a parameter, inside this method a print function "cout" is used, that print user input value with single and double quote.

Then the main method is declared, inside this method two integer variables "numFeet and numInches" are defined, which is used to take input value by user and pass the value in "printFeetInchShort()" function parameter and call the function.

4 0
3 years ago
Read 2 more answers
In some networks, the data link layer handles transmission errors by requesting that damaged frames be retransmitted. If the pro
Usimov [2.4K]

Answer:

The answer with explanation is attached in the file.

Explanation:

Download docx
3 0
3 years ago
What is a trojan horse in computer science?
Firdavs [7]

Answer:

type of malware that is often disguised as legitimate software. Trojans can be employed by cyber-thieves and hackers trying to gain access to users' systems. Users are typically tricked by some form of social engineering into loading and executing Trojans on their systems.

Explanation its malware

4 0
2 years ago
Other questions:
  • Which part of a window lets you see a fileâs contents without opening the file?
    9·1 answer
  • Why might people feel differently about their digital lives?
    11·1 answer
  • Which of the following is an advantage of using proprietary licensed software? The software’s source code can be easily modified
    7·2 answers
  • Which of the following best describes the 7x7 PowerPoint rule
    8·1 answer
  • Which of the following scanning technique attackers use to bypass firewall rules, logging mechanism, and hide themselves as usua
    11·1 answer
  • The algorithm ADDN implements N-bit fixed-width binary addition for non-negative integers and ignores overflows. For example, AD
    13·1 answer
  • Which one is not the future of wireless technology?
    8·1 answer
  • Your team will write a function that reverses a C-string, to practice using pointers. You must use pointers and C-strings for th
    6·1 answer
  • Random Walker Collisions In lecture, we saw how to model the behavior of a random walker on a 2D grid using a Monte Carlo simula
    8·1 answer
  • In GD, what does RWR stands for?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!