# Please Help me with Scheme

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 LinkBack Thread Tools Display Modes
 November 29, 2011, 14:56 Please Help me with Scheme #1 New Member   TiffanyGirl Join Date: Nov 2011 Posts: 1 Rep Power: 0 1. Describe the worst-case asymptotic running time of the all-positive? Scheme procedure defined below (from the Exam 1 comments). You may assume that all elements of p have values below some bound k, so the running time of > is constant. Remember to clearly define all variables you use in your answer. (define (all-positive? p) (if (null? p) true ; reached end without finding non-positive, so result is true (if (> (car lst) 0) (all-positive? (cdr lst)) ; keep looking false))) ; found one non-positive 2. Define a Scheme procedure make-cumulative! that takes as input a mutable list, and ￼modifies the list so that each element is the cumulative total of all elements up to and including itself. For example, ￼ >(define p (mlist 1 2 3 4 5)) ￼>(make-cumulative! p) ￼>p ￼{1 3 6 10 15} Also, what is the asymptotic running time of your make-cumulative! procedure. You should not assume the running time of the + procedure is constant; instead, assume that its running time is linear in the size (number of bits) of its inputs. Thank you all soo much. Love, Tiffany xxxoooxx

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Far FLUENT 0 May 22, 2011 01:50 iilw1314 Main CFD Forum 3 September 30, 2010 10:43 Romuald Skoda Main CFD Forum 10 August 3, 2010 12:23 sebastian_vogl OpenFOAM Running, Solving & CFD 0 January 5, 2009 12:08 Chandra Main CFD Forum 6 February 14, 2007 12:21

All times are GMT -4. The time now is 09:05.

 Contact Us - CFD Online - Top