Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem 1. In your favorite language write a tail-call recursive function. You m

ID: 3876888 • Letter: P

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 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))

Explanation / Answer

If you post more than 1 question, as per chegg guidelines I have to answer only 1 question.

Problem 5.

v1. assume v1 is initialized and positive

X :

    if v1 > 0 then

        Statement

        v1 <-- v1 - 1

        GoTo X

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote