Question: Problem 1. In your favorite language write a tail-call recursive function. You might need a helper function. (can be written in Java even though Java
Problem 1.
In your favorite language write a tail-call recursive function. You might need a helper
function. (can be written in Java even though Java doesn't support that feature. If you
need an example check Christoph's notes)
n
i
i =1
Problem 2.
Provide a pseudo code alternative to the following loop that utilizes a GOTO statement
---------------------------------------------------
Algorithm 1 Mah special LOOP
-------------------------------------------
v1. assume v1 is initialized and positive
v2 <-- 0
LOOP:
if v1 = v2 then
Statement
v2 <-- v2 + 1
else
GoTo OUT:
end if
GoTo LOOP:
OUT:
Problem 3.
Write a recursive function that computes the following expression L= {an bn, n >= 0}
Problem 4.
Provide an alternative to the following function that utilizes a GOTO statement instead of a WHILE loop
------------------------------------------------
Algorithm 2 Mah other special LOOP
-----------------------------------------
v1. assume v1 is initialized and positive
while v1 > 0 do
Statement
v1<-- v1 - 1
end while
Problem 5.
Translate the following function from prefixed to infix notation
(< ( (mod a b)(+ c d)) (* e f))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
