name = 'mirrorBT/2' slug = 'flip a binary tree horizontally' description = '''\
mirrorBT(T, NewT)
: the binary tree NewT
is obtained from T
by flipping it over the vertical axis through the root node.
?- mirrorBT(b(b(b(nil,4,nil),2,b(nil,5,nil)),1,b(nil,3,nil)), X). X = b(b(nil,3,nil), 1, b(b(nil,5,nil), 2, b(nil,4,nil))).''' hint = {}