Lists
Write the following predicates on lists.
• equal/2 meaning that both given lists a...
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, 22.06.2019 17:00
Your computer running windows 10 is doing some very strange things with the operating system. you are fairly certain it is not a hardware issue. you need to try to get further insight into what is going on within the operating system. which tool would be best suited for this?
Answers: 2
Computers and Technology, 22.06.2019 21:50
Answer the following questions regarding your system by using the commands listed in this chapter. for each question, write the command you used to obtain the answer. a. what are the total number of inodes in the root filesystem? how many are currently utilized? how many are available for use? b. what filesystems are currently mounted on your system? c. what filesystems are available to be mounted on your system? d. what filesystems will be automatically mounted at boot time?
Answers: 1
Computers and Technology, 23.06.2019 02:30
How to launch an app: steps to be successful? launching an app is a great idea, but it’s not that easy as we supposed to think. the majority of mobile applications don’t generate revenue because companies aren’t ready to be competitive. referring to our experience in successfully building and launching apps we hope to you omit these difficulties. we are going to talk about ideas, marketing, testing your product, its development, distribution and support. you will learn 8 product launch stages to succeed.
Answers: 1
Computers and Technology, 23.06.2019 04:10
2pointswho was mikhail gorbachev? oa. a russian leader who opposed a coupob. a polish leader who founded the labor union "solidarityoc. a soviet leader who called for a closer relationship with the unitedstates, economic reform, and a more open societyd. a soviet leader who called for more oppression in the soviet union
Answers: 3
Mathematics, 26.05.2021 18:30
Mathematics, 26.05.2021 18:30
Social Studies, 26.05.2021 18:30
Health, 26.05.2021 18:30
English, 26.05.2021 18:30
Mathematics, 26.05.2021 18:30