# coding=utf-8 name = 'memberBT/2' slug = 'find elements in a binary tree' description = '''\
memberBT(X, T)
: X
is an element of the binary tree T
. A binary tree node is represented with the structure b(L, E, R)
, where L
and R
are left and right subtrees, respectively, and E
is the node's value. An empty tree is denoted by nil
.
?- memberBT(X, b(b(nil,2,nil),1,b(nil,3,nil))). X = 1 ; X = 2 ; X = 3.''' hint = {}