Question: In PROLOG!!!!! To create a binary search tree in PROLOG, how would I create the following predicates? preOrderWrite/2 inOrderDisplay/1 inOrderWrite/2 postOrderDisplay/1 postOrderDisplay/1 getMin/2 Attached is
In PROLOG!!!!!
To create a binary search tree in PROLOG, how would I create the following predicates?
preOrderWrite/2
inOrderDisplay/1
inOrderWrite/2
postOrderDisplay/1
postOrderDisplay/1
getMin/2
Attached is the description of what they are suppose to be.

/* First argument is a BST and the second argument is a file name. Visits the tree nodes in preorder recursively and writes its data to the file separated by spaces. */ preorderwrite/2 / Argument is a BST. Visits the tree nodes in inorder recursively and displays its data to the terminal. */ inorderdisplay/1 / First argument is a BST and the second argument is a file name. Visits the tree nodes in inorder recursively and writes its data to the file separated by spaces. */ inorderwrite/2 /* Argument is a BST. Visits the tree nodes in postorder recursively and displays its data to the terminal. */ postorderDisplay/1 /* First argument is a BST and the second argument is a file name. Visits the tree nodes in postorder recursively and writes its data to the file separated by spaces. */ postorderwrite/2 /* First argument is a BST. The second argument is matched with the smallest value in the tree. If the tree is empty, the second argument is matched with 1 of the predicate may fail. */
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
