Give an implementation of adjoin-set using the ordered representation. By analogy with element-of-set? show how to take advantage of the ordering to produce a procedure that requires on the average about half as many steps as with the unordered representation.
There are no comments yet.
You must log in to post a comment.Login
(define x (adjoin-set 2 '())) (define y (adjoin-set 0 x)) (define z (adjoin-set 1 y)) (define q (adjoin-set 1 z)) (check-equal? z q) (check-equal? (adjoin-set 1 (adjoin-set 0 (adjoin-set 2 '()))) (adjoin-set 1 (adjoin-set 2 (adjoin-set 0 '()))))