Subject: insert and delete

From: j s <[email-masked]>
Date: 21 Nov 00 02:15:33 EST

Hello!

Could someone tell me how can I write the following prolog predicates:

insert(Old,N,New) -- succeeds iff Old and New are well-formed BSTs containing
integers, N is a number, and New is the BST you'd get from inserting N into
Old. 

delete(Old,N,New) -- succeeds iff Old and New are well-formed BSTs containing
integers, N is a number, and New is the BST you'd get from deleting N into
Old. 

I'm representing my well-formed BSTs as follows:

          3
         / \
        1   5

node(3,node(1,empty,empty),node(5,empty,empty))

(analogous to node(V,L,R) where V is the value at the root, L is the left
subtree, and R is the right subtree). 

____________________________________________________________________
Get free email and a permanent address at http://www.amexmail.com/?A=1