Hi,
I wrote the nwxt codes:
(define (prefix k lst)
(cond ( (= k 0) '())
( (null? lst) '())
(else (cons (car lst) (prefix (- k 1) (cdr lst))))))
(define (runs k lst)
(let ((p (prefix k lst)))
(if (> k (length p)) '()
(cons p (runs k (cdr lst))))))
-------------
(define (accumulate op initial sequence)
(if (null? sequence)
initial
(op (car sequence)
(accumulate op initial (cdr sequence)))))
(define (accumulate-runs k op init lst)
(map (lambda (x) (accumulate op init x))
(runs k lst)))
----------------
I'm not very familiar with this subject, so I need to ask. What is the
complexity of the two codes above?
Thanks for any kind of help.
--
View this message in context:
http://old.nabble.com/Complexity-tp26893993p26893993.html
Sent from the Gnu - MIT Scheme - Dev mailing list archive at Nabble.com.
_______________________________________________
MIT-Scheme-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/mit-scheme-devel