Project:
 ```1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 ``` ```; pairing heaps (define pq-empty '()) (define pq-empty? null?) (define (pq-first pq) (if (null? pq) (error 'pq-first "can't extract minimum from null queue") (car pq))) (define (pq-merge lt? p1 p2) (cond ((null? p1) p2) ((null? p2) p1) ((lt? (car p2) (car p1)) (cons (car p2) (cons p1 (cdr p2)))) (else (cons (car p1) (cons p2 (cdr p1)))))) (define (pq-insert lt? x pq) (pq-merge lt? (list x) pq)) (define (pq-merge-pairs lt? ps) (cond ((null? ps) '()) ((null? (cdr ps)) (car ps)) (else (pq-merge lt? (pq-merge lt? (car ps) (cadr ps)) (pq-merge-pairs lt? (cddr ps)))))) (define (pq-rest lt? pq) (if (null? pq) (error 'pq-rest "can't delete minimum from null queue") (pq-merge-pairs lt? (cdr pq)))) (define (list->pq lt? xs) (let loop ((xs xs) (pq pq-empty)) (if (null? xs) pq (loop (cdr xs) (pq-insert lt? (car xs) pq))))) (define (pq->list lt? pq) (let loop ((pq pq) (xs '())) (if (pq-empty? pq) (reverse xs) (loop (pq-rest lt? pq) (cons (pq-first pq) xs))))) (define (pq-sort lt? xs) (pq->list lt? (list->pq lt? xs))) (display (pq-sort < '(3 7 8 1 2 9 6 4 5))) ```
 ```1 ``` `(1 2 3 4 5 6 7 8 9)`