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 n <3
Return (n +1)
If n >=3
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?

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!