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
Andrej [43]
4 years ago
11

github Portfolio Balances An investor opens a new account and wants to invest in a number of assets. Each asset begins with a ba

lance of o, and its value is stored in an array using 7-based indexing. Periodically, a contribution is received and equal investments are made in a subset of the portfolio. Each contribution will be given by investment amount, start index, end index. Each investment in that range will receive the contribution amount. Determine the maximum amount invested in any one investment after all contributions
Computers and Technology
1 answer:
OLEGan [10]4 years ago
6 0

The following code will be used to determine the maximum amount invested

<u>Explanation:</u>

long maxValue(int n, int rounds_rows, int rounds_columns, int into rounds)

{

   // Define the variable to store

   // the maximum amount invested.

   long max = 0;

   

   // Define an array of size n,

   // to store the n investments.

   long *investments = (long*)malloc(sizeof(long)*n);

   int i=0;  

   // Initially set all

   // the investments to 0.

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

   {

       investments[i] = 0;

   }

   i=0;

   // Run the loop to

   // perform the rounds.

   while(i<rounds_rows)

   {

       // Get the left value

       // of the current round.

       int left = rounds[i][0];

       

       // Get the right value

       // of the current round.

       int right = rounds[i][1];

       // Get the contribution

       // for the current round.

       int contribution = rounds[i][2];

       // Since the user uses 1-based

       // indexing, subtract 1 from left

       // and right as the program uses

       // 0-based indexing. That is, the

       // investments in the array start

       // from 0 and not 1.

       right = right - 1;

       int j=0;

       // Run the loop to add the

       // contribution to all the investments

       // between left and right, both inclusive.

       for(j=left; j<=right; j++)

       {

           investments[j] += contribution;

       }

       i++;

   }

   // Traverse the investments array

   // to find the maximum element.

   max = investments[0];

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

   {

       if(investments[i]>max)

       {

           max = investments[i];

       }

   }

   // Return the

   // maximum investment.

   return max;  

}

You might be interested in
How many bits are necessary for a binary representation (unsigned) of:
pshichka [43]

Answer:

Hi!

The answer to:

a. 6 bits.

b. 9 bits.

c. 26 bits.

Explanation:

a. For the states of the U.S.A, you need 50 or more combinations to represents each element.

<u>If you use 6 bits, the possible combinations are 2⁶ = 64.  </u>

b. For days in a year, you need 365 or more combinations to represents each element.

<u>If you use 9 bits, the possible combinations are 2⁹ = 512. </u>

c. For inhabitants of California, you need 36,457,549 or more combinations to represents each element.

<u>If you use 26 bits, the possible combinations are 2²⁶ = 67,108,864.</u> If you use 25 bits instead of 26, then you have 2²⁵ = 33,554,432 combinations. These possible combinations are not enough to represent each inhabitant.

4 0
3 years ago
what is the first step in necessary to begin setting up a website once a host has been selected and paid
kenny6666 [7]

explain this more please..

6 0
3 years ago
Read 2 more answers
The main reason for using a comment in your HTML code is to
zvonat [6]

Answer:

D, document and explain parts of code

Explanation:

Mark me brainliest :)

8 0
2 years ago
Who is GodLJonathan?​50 FREE POINT$!!
Irina-Kira [14]

Answer:

i don't know..

..goo gle it ...............

6 0
3 years ago
Read 2 more answers
The Windows Group Policy feature provides __________ that govern the way Windows operates in enterprise environments. a. a centr
WITCHER [35]

Answer:

a.

Explanation:

The Windows Group Policy feature provides a centralized set of rules that govern the way Windows operates in enterprise environments. The Windows Group Policy is found in every single Microsoft Windows operating system, and fully controls the working environment of user accounts and computer accounts. This feature allows the user to manually make restrictions and changes such as blocking access to certain sections of the Windows control panel or setting a specific website as the home page for every account on the network.

4 0
3 years ago
Other questions:
  • How can I get more Gems in the game {Fashion Empire} through a Fire kindle?
    15·2 answers
  • What career is likely to have to highest salary
    14·2 answers
  • Which device stores data only temporarily, and only when the computer is running?
    12·1 answer
  • Two groups of simple machines and list the simple machines that belong in each group
    7·1 answer
  • Green Field county stadium is planning to conduct a cricket match between two teams A and B. A large crowd is expected in the st
    8·1 answer
  • When workers use techology to work from home or an office center, they are
    7·2 answers
  • What is Automation ? Please give an example ?
    14·1 answer
  • Which of the examples is part of client-side code?
    12·1 answer
  • Project: Digital Media and Business
    9·1 answer
  • Universal containers wants internal support requests to be directed to any of the IT reps. They want external support requests t
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!