CFD Online Logo CFD Online URL
Home > Forums > Fluent UDF and Scheme Programming

Please Help me with Scheme

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   November 29, 2011, 14:56
Default Please Help me with Scheme
New Member
Join Date: Nov 2011
Posts: 1
Rep Power: 0
tiffanygirl is on a distinguished road
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

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

Tiffany xxxoooxx
tiffanygirl is offline   Reply With Quote


Thread Tools
Display Modes

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
2nd order upwind scheme (Fluent and CFX) Far FLUENT 0 May 22, 2011 01:50
how to understand high resolution scheme and high order scheme iilw1314 Main CFD Forum 3 September 30, 2010 10:43
Implementation of QUICK scheme Romuald Skoda Main CFD Forum 10 August 3, 2010 12:23
Definition of limiter function for central dirrerencing scheme sebastian_vogl OpenFOAM Running, Solving & CFD 0 January 5, 2009 12:08
extrapolation in MUSCL scheme Chandra Main CFD Forum 6 February 14, 2007 12:21

All times are GMT -4. The time now is 12:38.