subject

USE PROLOG Write a file name 'bstStuff. pl' For all of the below, we'll represent a Binary Search Tree in prolog the following way:
bst(L, V, R)
.. where:
we presume 'V' is a number
'L' is a 'bst' holding elements strictly less than 'V', or is empty
'R' is a 'bst' holding elements greater than or equal to 'V', or is empty
'nil' represents an empty node/subtree
e. g.:
a very small bst holding only '1' is:
bst(nil, 1, nil).
a balanced bst holding '1' through '3' is:
bst( bst(nil, 1, nil), 2, bst(nil, 3, nil)).
an imbalanced bst holding '1' through '3' is:
bst( bst( bst( nil, 1, nil), 2, nil), 3, nil).
'bstStuff. pl' should contain three definitions:
get_min(bst(L, V, R), X) where 'X' is the minimal element in the bst given. You need no more than two rules to define it, but you can use as many as you like.
get_max(A, X) where 'X' is the maximal element in the bst given. You need no more than two rules to define it, but you can use as many as you like.
is_bst(bst(L, V, R)) where the bst is tested to see if it is a correctly-formed bst. You need no more than one rule to define it, but you can use as many as you like. While using only one rule might feel a bit complex, it will make the definition much cleaner and easier to debug. Hint: think about what it means for a tree to be a bst and take a look at get_min and get_max.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 14:50
Drag each label to the correct location on the image list the do’s and don’ts of safeguarding your password. a. keep yourself logged in when you leave your computer.b. don’t write your password down and leave it where others can find it.c. share your password with your friends.d.each time you visit a website,retain the cookies on your computer.e. use a long password with mixed characters.1. do's 2. don'ts
Answers: 2
question
Computers and Technology, 22.06.2019 15:30
Why would a programmer use the logical operator and in an if statement? a: when an action is to be taken that requires both conditions to be falseb: when an action is to be taken that requires both conditions to be truec: when an action is to be taken that requires the first condition to be falsed: when an action is to be taken that requires the second condition to be truei took the test and the answer is b.
Answers: 3
question
Computers and Technology, 22.06.2019 18:00
Determine whether the following careers would require training or college.
Answers: 1
question
Computers and Technology, 22.06.2019 22:30
I'll mark brainliest if answered right! with which feature or menu option of a word processing program can you make an image like this? you can get this image using the option of a word processing program.
Answers: 1
You know the right answer?
USE PROLOG Write a file name 'bstStuff. pl' For all of the below, we'll represent a Binary Search T...
Questions
question
English, 08.10.2019 04:00
question
Business, 08.10.2019 04:00
question
Mathematics, 08.10.2019 04:00