Question-54

Question-54

Determine which characteristics of an algorithm described in the text (after Algorithm 1) the following procedures have and which they lack. Select characteristics that the procedures have and leave characteristics unselected that the procedures lack.

a) procedure double (n : positive integer

while  n > 0

n  – 10n

 

b)  procedure divide  ( n : positive integer)

while  n  \geq 0

m =  \frac{1}{n}

n = n – 1

 

c)  procedure sum  ( n : positive interger)

sum = 0

while i < 7

sum = sum + i

 

d) procedure chose ( a , b : integers)

x = either a or b

 

Solution

a) 

Input

Output

Definiteness

Correctness

Effectiveness

Generality

 

b) 

Input

Output

Definiteness

Correctness

Finiteness

Generality

 

c)

Input

Output

Correctness

Finiteness

Effectiveness

Generality

 

d)

Input

Output

Correctness

Finiteness

Effectiveness

Generality

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *