Indicating the number of steps taken by the algorithm

Assignment Help Basic Computer Science
Reference no: EM132318146

In the following segment of code:

void say_hello(int n) {

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

for (int j = i; j <= n; j++) {

puts("hello");

}

}

}

i) Give an exact function (with respect to n) indicating the number of steps taken by the algorithm. Clearly show your work.

ii) Using the function from part i), Indicate the running time of the algorithm using O-notation (function class).Explain your reasoning.

Reference no: EM132318146

Questions Cloud

Prim mst algorithm will work correctly : Prove or disprove: Prim's MST algorithm will work correctly even if weights may be negative.
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

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Justifications for recommending it or denouncing it

Question: Based on your understanding of computer forensics, would you recommend it as a career option to your friends and family members?

  Requirements and assumptions for new interface design

You are to prepare the project scope and initial requirements and assumptions for a new Interface Design project for the Museum Guided Exhibition as outlined in the Museum Guided Exhibition problem case study.

  Can this process occur adiabatically

During a throttling process, the temperature of a fluid drops from 30 to -20°C. Can this process occur adiabatically?

  Discuss the advantages of representing phasors

Discuss the advantages of representing phasors in complex and polar form. Include examples for which one or another form is most advantageous.

  How many bytes to skip after reading block

Write a function foo(int fd, char* buf, int b_size, int n, int skip) that reads to buf from file with file descriptor fd, n blocks of size b_size each. The last argument specifies how many bytes to skip after reading each block.

  What does this increment determine

SKETCH requires a Record increment. What does this increment determine? (If you are not sure, specify a relatively large increment such as .5 or 1 and notice the appearance of the sketch lines.)

  Equilibrium in this perfectly competitive market

In a perfectly competitive market, demand is given by Qd(P) = 60 - P. There exist 300 identical firms. Each firm's short run total cost function

  Basic forms of input-output

1. Linux distributions have three basic forms of Input/Output (standard input, standard output, and standard error) redirections which will need to understand how to use each one.

  Environmental analysis important for an organization

Why is environmental analysis important for an organization? Please be detailed.

  Find helen’s home directory on the hard drive

Research the solution for setting up Helen with a correctly named account.

  Appearance of the caret moving

In CS125 you used the following escape sequence n to print a new line character. What happened was the appearance of the 'caret' moving

  What is a global variable

What is a global variable? What is a class variable? What is a local variable? When do variable get created in memory and when are they released from memory?

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