CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Please Help me with Scheme

Register Blogs Community New Posts Updated Threads Search

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

Reply


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


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


All times are GMT -4. The time now is 22:47.