Question: RTC ( n ) Input: A nonnegative integer, n Output: A numerator or denominator ( depending on parity of n ) in an approximation of

RTC(n)
Input: A nonnegative integer, n
Output: A numerator or denominator (depending on parity of n) in an approximation of
If n3
Return (n+1)
If n3
t:=RTC(n-1)
If n is odd
s:=RTC(n-2)
Return (s+t)
If n is even
r:=RTC(n-3)
Return(r+t)
If n is even
print 'Your approximation is ', RTC(n),'/', RTC(n -1),,'
What is the output for the algorithm if the input n is 6?
Less
Your approximation is 17/12.
Your approximation is 17/7.
Your approximation is 12/7.
Your approximation is 12/5.
 RTC(n) Input: A nonnegative integer, n Output: A numerator or denominator

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!