February 27, 2017

Homework Help: Discrete Mathematics

Posted by Compstudent on Wednesday, March 30, 2011 at 10:10pm.

How many elementary operations are used in the following algorithm?

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

Step 2 Print S

My answer was: 4*n+1
I don't know if it is right :(

Answer This Question

First Name:
School Subject:

Related Questions

More Related Questions