Indicate the total running time of the algorithm

Assignment Help Business Management
Reference no: EM132322726

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: EM132322726

Questions Cloud

Brief description of the program : Input List and Output List, and full pseudocode. Place the pseudocode for each module above the module's Python code.
Establish an appropriate set of guidelines for hacker code : How can you establish an appropriate set of guidelines for hacker code of ethics without becoming a moral relativist?
Explain what is the relevance of the thermal diffusivity : Explain what is the relevance of the Thermal Diffusivity of a brick to the temperature measured on the hot side of a brick wall heated on one side
Connected undirected graph with distinct edge weights : Let G = (V,E) be a connected undirected graph with distinct edge weights. Prove that G has a unique minimum spanning tree.
Indicate the total running time of the algorithm : 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
Nfa that recognizes exactly the language described : For each of the following, draw a NFA that recognizes exactly the language described.
What temperature would the plate heat up to : How much radiant heat energy would it be emitting over every square metre of surface area - what temperature would the plate heat up to
What is cli and gui : What is CLI and GUI? And what are the similarities/differences about them?
Directed graph with negative-weight edges : Give a simple example of a directed graph with negative-weight edges for which Dijkstra's algorithm produces incorrect answers.

Reviews

Write a Review

Business Management Questions & Answers

  Caselet on michael porter’s value chain management

The assignment in management is a two part assignment dealing 1.Theory of function of management. 2. Operations and Controlling.

  Mountain man brewing company

Mountain Man Brewing, a family owned business where Chris Prangel, the son of the president joins. Due to increase in the preference for light beer drinkers, Chris Prangel wants to introduce light beer version in Mountain Man. An analysis into the la..

  Mountain man brewing company

Mountain Man Brewing, a family owned business where Chris Prangel, the son of the president joins. An analysis into the launch of Mountain Man Light over the present Mountain Man Lager.

  Analysis of the case using the doing ethics technique

Analysis of the case using the Doing Ethics Technique (DET). Analysis of the ethical issue(s) from the perspective of an ICT professional, using the ACS Code of  Conduct and properly relating clauses from the ACS Code of Conduct to the ethical issue.

  Affiliations and partnerships

Affiliations and partnerships are frequently used to reach a larger local audience? Which options stand to avail for the Hotel manager and what problems do these pose.

  Innovation-friendly regulations

What influence (if any) can organizations exercise to encourage ‘innovation-friendly' regulations?

  Effect of regional and corporate cultural issues

Present your findings as a group powerpoint with an audio file. In addition individually write up your own conclusions as to the effects of regional cultural issues on the corporate organisational culture of this multinational company as it conducts ..

  Structure of business plan

This assignment shows a structure of business plan. The task is to write a business plane about a Diet Shop.

  Identify the purposes of different types of organisations

Identify the purposes of different types of organisations.

  Entrepreneur case study for analysis

Entrepreneur Case Study for Analysis. Analyze Robin Wolaner's suitability to be an entrepreneur

  Forecasting and business analysis

This problem requires you to apply your cross-sectional analysis skills to a real cross-sectional data set with the goal of answering a specific research question.

  Educational instructional leadership

Prepare a major handout on the key principles of instructional leadership

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