Calculate the exact number of steps

Assignment Help Business Economics
Reference no: EM132318145

Consider the following function:

int mystery3(int n)

{

int s = 0;

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

{

int ci = 0;

for (int j=1; j<=i; j++)

{

ci+=1;

}

s += ci;

}

return s;

}

i) Indicate the total running time of the algorithm using O-notation (function class). Clearly show your work. You do not need to calculate the exact number of steps but clearly indicate how you arrived at the answer.

ii) Create an English statement to describe what the function does-hint, try running the program in the terminal.

iii) Can this function be improved with respect to its big-O running time? If so, write down the improved function(in pseudo-code or in proper C code). If not, clearly indicate why it cannot be improved (you may use an English explanation -no formal proof necessary)

Reference no: EM132318145

Questions Cloud

Unique minimum spanning tree : Let G = (V,E) be a connected undirected graph with distinct edge weights. Prove that G has a unique minimum spanning tree.
Define the scope of sustainability policy at MNMK Education : BSBSUS501 - Develop Workplace Policy and Procedures for Sustainability Assignment - Academies Australasia, Australia. Define scope of sustainability policy
Analyze how the guidelines should be implemented : As part of the case study, imagine that the hospital that was just acquired (the one you have been researching) is currently doing research or will be doing.
Indicating the number of steps taken by the algorithm : Give an exact function (with respect to n) indicating the number of steps taken by the algorithm. Clearly show your work.
Calculate the exact number of steps : Indicate the total running time of the algorithm using O-notation (function class). Clearly show your work.
What is one negative health impact from carbohydrate intake : What is one negative health impact from carbohydrate intake? What is one positive health impact from carbohydrate intake? Here is a sample one-day menu.
Input value should be read from memory location : Need help with an algorithm to count the number of 1's in a 32-bit number in a high level language like C or Java. implementing it with MIPSzy
Compare process layouts and product layouts : Identify and describe different types of layouts. Describe the steps involved in designing a process layout. Compare process layouts & product layouts
Idea of the customer relation management : The idea of the Customer Relation Management (CRM) is Good, but this is considered a strategy for business. CRM is a tool used for client management

Reviews

Write a Review

Business Economics Questions & Answers

  Do you find that in recent years that housing has became

Do you find that in recent years that housing has became more difficult for consumers to achieve?

  Domestic and foreign interest rates are both initially equal

The following question is based on fixed exchange rate and/or flexible exchange rate regime in an open macroeconomic model. The answers must be written in your words along with graphical illustration. Without explaining in your words, the graphical i..

  What marketing recommendations would you make to mcc

What individual product decisions and product line decisions has MCC made for Smart Car. Why did it make these decisions. What marketing recommendations would you make to MCC.

  Factor and constant returns to scale

Show in a diagram that a production function an have diminishing marginal returns to a factor and constant returns to scale.

  Possibility frontier exhibiting increasing opportunity cost

Cattletown steakhouse is a restaurant known for its steak meal and hamburger basket. Draw a graph showing a production possibility frontier exhibiting increasing opportunity costs.

  Categories of proprietorships-partnerships

The division of US businesses in the categories of proprietorships, partnerships, and corporations is based on 1) generally accepted accounting principles 2) legal considerations 3) the judgment of the American economic assoc 4) an executive order of..

  About the term structure of interest rates

Explain what typically happens to bond interest rates in US recessions. Use the demand and supply graph but clearly label any curve shifts and explain the reasons behind those shifts. How does the Segmented Markets theory explain the second fact abou..

  Alternative policies or paths to economic growth-prosperity

Briefly discuss why Thomas Jefferson and ALexander Hamilton understandably prompted alternative policies or paths to economic growth and prosperity. (If i remember correctly one believed in using slaves to make economic growth and prosperity and sell..

  Which of the stands true of corruption

Which of the following stands true of corruption?

  Characteristic of equal potential GDP and real GDP

Which of the following is NOT a characteristic of equal potential GDP and real GDP?

  Your first assignment as an engineering technology graduate

your first assignment as an engineering technology graduate from the university of houston downtown is to recommend to

  Develop a universal set of ethical standards for business

Do you feel that it is possible to develop a universal set of ethical standards for business, or do you believe that cultural differences make universal standards impractical and/or impossible?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd