How many elementary operations are used in algorithm

Assignment Help C/C++ Programming
Reference no: EM13938818

1) Use the method of Iteration to find a formula expressing S(n) as a function of n for the given recurrence relation and initial condition: S(n) = S(n-1) - 3, S(0)=5.

2) How many elementary operations are used in the following algorithm? The elementary operations are comparison operations (such as > and < ) and mathematical operations (such as addition, subtraction, multiplication, division etc.).

Step 1: Set S=a, k=0, and t=a.

Step 2: while k < n
(a) Replace t with t+d
(b) Replace S with S+t
(c) Replace k with k+1
endwhile

Step 3: Print S.

3) How many elementary operations are used in the following algorithm? The elementary operations are comparison operations (such as > and < ) and mathematical operations (such as addition, subtraction, multiplication, division etc.).

Step 1: Set a=1, b=1, c=2, and k=1.

Step 2: while k < n

(a) Replace c with a+b

(b) Replace a with b

(c) Replace b with c

(d) Replace k with k+1

endwhile

Step 3: Print b.

Reference no: EM13938818

Questions Cloud

International business to undertake existing overseas market : The purpose of this assignment is to provide an opportunity to utilise your skills and knowledge of international business to undertake an analysis of a new overseas market or an existing overseas market where significant expansion should be imple..
Compute depreciation expense using straight-line method : Compute 2009 depreciation expense using the straight-line method, double-declining-balance method and units-of-production method. What is the book value of the machine at the end of 2009?
What is the amount of the aftertax lease payment : Jamestown Supply is trying to decide whether to lease or buy some new equipment. The equipment costs $72,000, has a 4-year life, and will be worthless after the 4 years. The equipment will be replaced. The cost of borrowed funds is 9 percent and the ..
Describe the internal structure and function of the heart : Describe the internal structure and function of the heart. Compare arteries and vein based on structure and function.
How many elementary operations are used in algorithm : How many elementary operations are used in the following algorithm? The elementary operations are comparison operations (such as > and
Identify and describe two musical elements : Identify and describe two musical elements from the songs blue  moon of Kentucky and walkin blues what they have in common and where they differ
Compute the unit sales price at which blake must sell : Calculate a value in response to the following: Unhappy about the prospect of a price increase, Blake's sales manager would like data regarding the number of units that must be sold at the former price to earn the £200,000 profit.
Firm effective interest rate paid on receivables financing : For the year just ended, a firm had average accounts receivable of $90,000 and total credit sales of $700,000. Throughout the year, a factor purchased accounts receivable from the firm at a 1.5% discount. What was the firm’s effective interest rate p..
The system is expected to bring annual benefits : The system is expected to bring annual benefits of $35,000 over the 5 year period. Showing all calculations in Excel:

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a program that has user enter

Write a program that has user enter a sentence and then determine how many lower case letter were entered. You need to write a logically coherent function that will determine if character is lower case or not. Main will also display the total?

  Write a program in c which accepts 4 number

Write a program in C which accepts 4 numbers  from the user and stores them in an array. Using the pointer mathematics it traverses the array and get the sub of all the elements. Use only one pointer variable

  Write a program with three functions

Write a program with three functions: upper, lower, and reverse.

  Implement the program and find the item

This would be a function called into program. Struggling with the search aspect. Any clarification is greatly appreciated. File is 'inventory.dat'

  Calculate the total expences

Trying to fugure out how to enter a formula in a cell(d10) that multiplies 30 by the value in another cell (c27), then make the other cell (c27) an absolute cell reference in the formula. Copy the formula to cells d11:d13, and then calculate the t..

  Create a program that reads in two integers

Create a program that reads in two integers and then has a pointer point to the first variable and then to the second variable.

  Write appropriate mutator functions that store values

A default constructor that assigns empty strings ("") to the name, department, and position member variables, and 0 to the idNumber member variable.

  Prevent illegal moves without crashing

Your program must gracefully handle the case when a player tries to add a non-number to a square, or add a number that violates the Sudoku rules. It should prevent illegal moves without crashing.

  Analyze the test results of students

The XYZ Secondary School needs a program to analyze the test results of students. Each class consists of 30 students. The program should allow the user to enter the Integer test marks of all the students in a class using an input dialog box (refer..

  What are four examples of how direction can be used

What are four examples of how "direction" can be used in an effective publication?

  Counts all occurrences of a given string from such a bag

Write a C++ function that removes and counts all occurrences of a given string from such a bag.

  Refresher on andys basic requirements

The game Battleship is back and better than ever. Instead of hacking everything together in C, you will instead leverage C++ and all of your newly gained object oriented programming knowledge to construct a much cleaner end product.

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