好的,我試圖列入清單並從最大到最小排序。計劃整理清單
Example:
> (maxheap (list 5 6 2 1 18 7))
;output:
> (18 7 6 5 2 1)
因此,這裏是我走到這一步:
(define (mkmaxheap heaplist)
(let ((max (mymax(heaplist))))
;mymax is a func that returns max number, it works
(let ((head (car heaplist)) (tail (cdr heaplist)))
(if (null? tail)
newlist))))
這就是所有我能得到編譯,其他所有的代碼我寫失敗。任何幫助解決這個將不勝感激。