Determine which characteristics of an algorithm the followin
Determine which characteristics of an algorithm the following procedures have and which they lack. Select the characteristics that the procedures have and leave characteristics unselected that the procedures lack.
(Select all that apply)
1) procedure double(n : positive integer)
while n > 0
n 2n
(Select all that apply)
-Input
-Output
-Definiteness
-Finiteness
-Effectiveness
-Generality
2)procedure divide(n: positive integer)
while n 0
m 1/ n
n n 1
-Input
-Output
-Definiteness
-Finiteness
-Effectiveness
-Generality
3)procedure sum(n : positive integer)
sum := 0
while i < 10
sum := sum + i
-Input
-Output
-Definiteness
-Finiteness
-Effectiveness
-Generality
4) procedure choose(a, b: integers)
x := either a or b
-Input
-Output
-Definiteness
-Finiteness
-Effectiveness
-Generality
Solution
Post one more question to get the remaining answers
1) procedure double(n : positive integer)
while n > 0
n 2n
Since n is a positive number as defined in the input, hence the while loop will be going to continue forever since n will always be greater than zero in the while condition
Hence the algorithm will not be finite and it will run in an infinite loop
Hence it lacks finiteness
2)procedure divide(n: positive integer)
while n 0
m 1/ n
n n 1
The alogithm will not be an effective algorithm since for any positive integer value, there will be case arised when the value of n reaches by the line (n=n-1), at that point m=1/0, will not be defined
hence algorithm is not effective
algorithm is also not finite, since for this particular value of zero, the statement can\'t be executed
algoritthm is also not correct for that particular value
hence it lacks effectiveness, correctness and finiteness

