daily pastebin goal
8%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. bubbledown (Leaf a) = [a]
  2. bubbledown (Internal a (Leaf l) (Leaf r))  
  3.     | a > l && l < r = (Internal l (bubbledown a) r)
  4.     | a > r && r < l = (Internal r l (bubbledown a))
  5.     | a < r && a < l = (Internal a l r)
  6. bubbledown (Internal a1 (Leaf l1) (Internal a2 l2 r))  
  7.     | a1 > l1 && l1 < a2 = (Internal l1 (bubbledown a1) (Internal a2 l2 r))
  8.     | a2 > a2 && a2 < l1 = (Internal a2 l1 (bubbledown (Internal a1 l2 r)))
  9.     | a1 < a2 && a1 < l1 = (Internal a1 (Leaf l1) (Internal a2 l2 r))
  10. bubbledown (Internal a1 (Internal a2 l r1) (Leaf r2))  
  11.     | a1 > a2 && a2 < r2 = (Internal a2 (bubbledown(Internal a1 l r1) r2))
  12.     | a1 > r2 && r2 < a2 = (Internal r2 (Internal a2 l r1) (bubbledown a2))
  13.     | a1 < a2 && a1 < r2 = (Internal a1 (Internal a2 l r1) (Leaf r2))
RAW Paste Data
Top