Question: In Prolog help me figure out what is wrong with this delete predicate . The getMin function is working so i dont know why this

In Prolog help me figure out what is wrong with this delete predicate . The getMin function is working so i dont know why this is having issues.
\% delete/3: a predicate to delete an integer from a binary search tree \% Delete function to remove a node from a binary search tree. delete(nil, _, nil). delete(tree(X,nil,nil),X, nil). delete(tree( X, Left, nil), X, Left). delete(tree( X, nil, Right), X, Right). delete(tree(X, Left, Right), X, tree(Pred, NewLeft, RightNew)) :- getMin(Right, Pred), delete(Right, Pred, RightNew), replaceRoot(X, Pred, Left, NewLeft). delete(tree(X, Left, Right), Y, tree( X, NewLeft, Right)) :- Y
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
