تم الحل ✓
categoryبرمجة وتطوير البرمجيات
schoolبكالوريوس
event_available2026-07-14
السؤال
Transcribed Image Text:
13 A computer programmer needed to write a program that computes n! for
all non-negative integer values of n. Rather than using a recursive routine,
he used the fact that n! = T(n + 1), and used equation 6.16 to approximate
T(n+1). He then rounded this approximation to the nearest integer, since
the factorial will always be an integer. Since the two term approximation is
clearly accurate enough for n = 1, and only gets more accurate as n→ ∞o, he
figured this would work for all n. What was wrong with his logic?
~
1+
(6.16)
12n
13) Although the relative error gets better as n gets large, the absolute error
will increase to the point that the error will be more than 1. For example,
this algorithm will produce 8!= 40318, when the true value is 40320.
check_circle الجواب — حل مفصل خطوة بخطوة
hourglass_top
🔒
الحل الكامل متاح للمشتركين
اشترك في أرشيف الأسئلة لعرض هذا الحل وآلاف الحلول المفصلة خطوة بخطوة من معلمين معتمدين.