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
You are preparing to give a presentation at a client’s location using your mobile device and a large screen TV. You have success
Ray Of Light [21]

Answer:

The most probable reason for this is A.

Explanation:

B should be wrong because the TV being connected to a different network segment still means that it is on the Wi-Fi network, it is just using a different switch or a repeater.

C should be wrong because the brightness of the TV does not have anything to do with being able to connect to the phone.

D should be wrong because in the question itself it says that "you tap the mirroring option on your device" which clearly means that the mobile device supports display mirroring.

The answer should be A, if the device and the TV are not on the same Wi-Fi network, than they simply can not connect and the mirroring can not be done.

I hope this answer helps.

7 0
3 years ago
Your program does not calculate the average correctly.
Agata [3.3K]

Answer:

3

Explanation:

  • I think 3 is really the answer
7 0
3 years ago
A word or line of a paragraph at the bottom of the page indent is called _______
sashaice [31]

Answer:

Orphan

Explanation:

                               Orphan may be defined as the term given to a word or a line of a paragraph that is alone at the bottom of a page .

                              It is a  paragraph-opening sentence or word appearing  at the bottom of a column or page by itself,and it remain separated from the remaining text or paragraph.

                              Orphans and widows are not desirable and must be avoided while writing text.

Thus the answer is Orphan.

5 0
3 years ago
Read 2 more answers
Jennifer, a customer, informs you that unexpected icons are appearing on her system's desktop. You identify the symptoms of the
Maslowich

Answer:

B. Schedule scans and run updates.

Explanation:

With a malware infection you have to scan the computer with an antivirus immediately. Then, you run possible updates to get the system stronger.

8 0
4 years ago
Why is it important to stand clear and not touch the person while the AED is analyzing or defibrillating?
galben [10]

Answer:

Because you could also receive shock

Explanation:

Automatic external defibrillators can help save lives during sudden cardiac arrest.

Do not touch the person while the AED is analyzing; touching or moving the person can affect the analysis. You or another person could be injured by shock. And you could prevent the AED from analyzing your heart rate correctly.

5 0
3 years ago
Other questions:
  • How do you adjust the shear of a shape?
    10·2 answers
  • A python programmer is writing a function definition. What syntax should be used?
    6·1 answer
  • Write HTML code for inserting an image "cricket.jpeg" in size 500 width and 400 height.
    12·1 answer
  • What is outlook used for?
    14·2 answers
  • What does 69 mean?<br> Whenever I watch memes they always talk about the number 69
    8·2 answers
  • 2.<br> The force of impact is
    5·1 answer
  • You are configuring a firewall to use NAT. In the configuration, you map a private IP address directly to a persistent public IP
    9·1 answer
  • What is the web page path on the web server for the URL:
    12·1 answer
  • Using the Caesar cipher, "HELLO" is encrypted to "OLSSV" by applying a shift of 7. The number 7 is considered the __________
    5·1 answer
  • Drag the tiles to the correct boxes to complete the pairs. Match the conversion systems with their steps. To convert a decimal f
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!