Americas
Europe
Q18E
Expert-verifiedProve that Algorithm 1 for computing n! when n is a nonnegative integer is correct.
The required algorithm is proved by induction.
The algorithm is for when n is non-negative, the base case is .
factorial (0) = 0!
= 1
By induction hypothesis,
Therefore, the required algorithm is proved by induction.
94% of StudySmarter users get better grades.
Sign up for free