(define insertion-sort (lambda (numbers) (define insert (lambda (n numbers) ;;assuming numbers is in order, smallest to largest ;;returns a list that has n and all of the elements of numbers, in order )) (define insert-all (lambda (numbers answer-list) ;; inserts all of the elements in numbers ;; into the answer-list )) (insert-all numbers '()))) ;;;================================================================= (define merge-sort (lambda (lst) (define merge (lambda (lst1 lst2) (cond ((null? lst1) lst2) ((null? lst2) lst1) ((< (car lst1) (car lst2)) (cons (car lst1) (merge (cdr lst1) lst2))) ((= (car lst1) (car lst2)) (cons (car lst1) (merge (cdr lst1) (cdr lst2)))) (else (cons (car lst2) (merge lst1 (cdr lst2))))))) (cond ((null? lst) '()) ((null? (cdr lst)) lst) (else (merge (merge-sort (one-part lst)) (merge-sort (the-other-part lst))))))) (define odd-part (lambda (lst) (if (null? lst) '() (cons (car lst) (even-part (cdr lst)))))) (define even-part (lambda (lst) (if (null? lst) '() (odd-part (cdr lst))))) (define one-part odd-part) (define the-other-part even-part) ;;============================================ (define ways-to-make-change (lambda (amt coin-values) (cond ;; fill in base cases here (else (+ (ways-to-make-change (- amt (car coin-values)) coin-values) (ways-to-make-change amt (cdr coin-values)))))))