<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Sep 17, 2014, at 2:04 AM, mukesh tiwari wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Dear Racket Users,<br>I am learning racket and I found little bit misleading statement on guide [1]. It says that "<b>Both the my-length and my-map functions run in O(n) time for a list of length n.</b>". Technically this statement is correct but when I read below<br><br>"<b>For a list with n elements, evaluation will stack up n (+ 1 ...) additions, and then finally add them up when the list is exhausted.<br><br>You can avoid piling up additions by adding along the way. To accumulate a length this way, we need a function that takes both a list and the length of the list seen so far; the code below uses a local function iter that accumulates the length in an argument len</b>".<br><br>so just curious, shouldn't it be "<b>Both the my-length and my-map functions run in O(n) space for a list of length n.</b><span class="sewxpurehfscn19"></span><span class="sewxpurehfscn19"></span>" ?<br><br></div></blockquote><br></div><div>That's correct for straightforward versions of these functions. -- Matthias</div><div><br></div></body></html>