Computers and Technology, 09.07.2021 01:30 bnnn
Lists
Write the following predicates on lists.
• equal/2 meaning that both given lists are equal:
?- equal([3, 5, 2, 1], [3, 5, 2, 1]).
true
?- equal([3, 5, 2, 1], [1, 2, 3, 5]).
false
?- equal(bob, bob).
false
• contains/2 meaning that the list contains an element:
?- contains([3, 5, 2, 1], 2).
true
?- contains([3, 5, 2, 1], 4).
false
• reverse/2 meaning the first list is the reverse of the second.
?- reverse([3, 5, 2, 1], X).
X = [1, 2, 5, 3]
?- reverse (bob, X).
false
• sum/2 meaning the second member is the sum of elements in the first.
?- sum([3, 5, 2, 1], S).
S = 11
?- sum([], S).
S = 0
Binary trees
We will create a data structure that represents binary trees. Each node will be represented as bt(L, E, R), where L is the left subtree, R is the right subtree, and E is the element at the given note. An empty tree is denoted as the atom nil.
• Write the predicate binary_treee/1, that returns true if the argument is a binary tree:
?- binary_treee(nil)
true
?- binary_tree(bt(nil, 3, nil))
true
?- binary_tree(bt(bt(nil, 4, bt(nil, 5, nil)), 3, nil))
true
?- binary_tree(bt(nil, 3))
false
• Write the predicate in_order/2, that returns the list of arguments ordered by the in-order traversal (left-to-right: https://www. geeksforgeeks. org/tree-traversals-inorder-preorde r-and-postorder/ ):
?- in_order(bt(bt(nil, 4, bt(nil, 5, nil)), 3, nil), L)
L = [4, 5, 3]
Answers: 2
Computers and Technology, 21.06.2019 22:00
Determine which of the four levels of measurement (nominal, ordinal, interval, ratio) is most appropriate for the data below. internet speed levels of "fast comma " "medium comma " and "slow" choose the correct answer below. a. the ordinal level of measurement is most appropriate because the data can be ordered comma but differences left parenthesis obtained by subtraction right parenthesis cannot be found or are meaningless. nothing nothing nothing nothing nothing b. the interval level of measurement is most appropriate because the data can be ordered comma differences left parenthesis obtained by subtraction right parenthesis can be found and are meaningful comma and there is no natural starting point. c. the nominal level of measurement is most appropriate because the data cannot be ordered. nothing d. the ratio level of measurement is most appropriate because the data can be ordered comma differences left parenthesis obtained by subtraction right parenthesis can be found and are meaningful comma and there is a natural starting point.
Answers: 2
Computers and Technology, 23.06.2019 01:00
Complete the sentence about a presentation delivery method
Answers: 2
Computers and Technology, 23.06.2019 18:30
List 3 items that were on kens resume that should have been excluded
Answers: 1
Computers and Technology, 24.06.2019 07:00
Into what form does the barcode reader convert individual bar patterns?
Answers: 1
Lists
Write the following predicates on lists.
• equal/2 meaning that both given lists a...
• equal/2 meaning that both given lists a...
Mathematics, 13.02.2021 04:10
Mathematics, 13.02.2021 04:10
Mathematics, 13.02.2021 04:10
Chemistry, 13.02.2021 04:10
Mathematics, 13.02.2021 04:10
Mathematics, 13.02.2021 04:10
Mathematics, 13.02.2021 04:10
Mathematics, 13.02.2021 04:10
Mathematics, 13.02.2021 04:10
Mathematics, 13.02.2021 04:10
Social Studies, 13.02.2021 04:10
English, 13.02.2021 04:10
Mathematics, 13.02.2021 04:10