Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (heap-merge h1 h2)
- (cond
- [(leaf? h1) h2]
- [(leaf? h2) h1]
- [(< (elem-priority (heap-min h1)) (elem-priority (heap-min h2)))
- (make-node (heap-min h1) (heap-merge h2 (node-right h1)) (node-left h1))]
- [else (make-node (heap-min h2) (heap-merge h1 (node-right h2)) (node-left h2)) ]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement