Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 398 Weeks Ago, 2 Days Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 26 Aug 2017 My Price 9.00

tail recursive function

8.8Tail Recursion and Continuations

(a)     Explain why a tail recursive function, as in

fun fact(n) =

let fun f(n, a) = if n=0 then  a

else f(n-1, a*n)

in f(n, 1) end;

can be compiled so that the amount of space required for computing fact(n) is independent of n.

(b)     The function f used in the following definition of factorial is “formally” tail recursive: The only recursive call to f is a call that need not return:

fun fact(n) =

let fun f(n,g) = if n=0 then   g(1)

else f(n-1, fn x=>g(x)*n) in f(n, fn x => x) end;

How much space is required for computing fact(n), measured as a function of argument n? Explain how this space is allocated during recursive calls to f and when the space may be freed.

Answers

(5)
Status NEW Posted 26 Aug 2017 10:08 PM My Price 9.00

Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll

Not Rated(0)