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 04:40
Amain idea is supported, explained, or expanded on with a numbers b. a concluding statement c. details d. a topic sentence. im e paragraphs reset nex next
Answers: 2
question
Computers and Technology, 23.06.2019 09:30
The place where the extended axis of the earth would touch the celestial sphere is called the celestial
Answers: 1
question
Computers and Technology, 23.06.2019 10:50
Your friend kayla is starting her own business and asks you whether she should set it up as a p2p network or as a client-server network. list three questions you might ask to kayla decide which network to use and how her answers to those questions would affect your recommendation.
Answers: 2
question
Computers and Technology, 23.06.2019 18:30
Janice recently received her college degree and is looking for a job. she is worried that since she just finished school, she will be required to repay her perkins and direct subsidized loans immediately. janice pulls out the paperwork she signed and reviews it again for repayment information. after reading all of the information, janice discovers that
Answers: 2
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
Questions on the website: 13722361