daily pastebin goal
76%
SHARE
TWEET

Untitled

a guest Mar 23rd, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. is_heap(empty).
  2.  
  3. is_heap(tree(empty, _, empty)).
  4.  
  5. is_heap(tree(Left, Number, empty)) :-
  6.     Left = tree(_, Left_Number, _),
  7.     Number =< Left_Number,
  8.     is_heap(Left).
  9.  
  10. is_heap(tree(empty, Number, Right)) :-
  11.     Right = tree(_, Right_Number, _),
  12.     Number =< Right_Number,
  13.     is_heap(Right).
  14.    
  15. is_heap(tree(Left, Number, Right)) :-
  16.     Left = tree(_, Left_Number, _),
  17.     Right = tree(_, Right_Number, _),
  18.     Number =< Left_Number,
  19.     Number =< Right_Number,
  20.     is_heap(Left),
  21.     is_heap(Right).
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top