Menu


Notice: Undefined index: url2 in /home/u681245571/domains/studyglance.in/public_html/labprograms/sdcdisplay.php on line 84

Notice: Undefined index: url3 in /home/u681245571/domains/studyglance.in/public_html/labprograms/sdcdisplay.php on line 85

Notice: Undefined index: url4 in /home/u681245571/domains/studyglance.in/public_html/labprograms/sdcdisplay.php on line 86

Notice: Undefined index: opurl2 in /home/u681245571/domains/studyglance.in/public_html/labprograms/sdcdisplay.php on line 89

Notice: Undefined index: opurl3 in /home/u681245571/domains/studyglance.in/public_html/labprograms/sdcdisplay.php on line 90

Notice: Undefined index: opurl4 in /home/u681245571/domains/studyglance.in/public_html/labprograms/sdcdisplay.php on line 91

Skill Development Course (Prolog) [ Lab Programs ]


Aim:

Assume the prolog predicate gt(A, B) is true when A is greater than B. Use this predicate todefine the predicate addLeaf(Tree, X, NewTree) which is true if NewTree is the Treeproducedby adding the item X in a leaf node. Tree and NewTree are binary search trees. Theempty treeis represented by the atom nil.

Solution :

<br />
<b>Warning</b>:  include(ai/week10.pl): failed to open stream: No such file or directory in <b>/home/u681245571/domains/studyglance.in/public_html/labprograms/sdcdisplay.php</b> on line <b>113</b><br />
<br />
<b>Warning</b>:  include(): Failed opening 'ai/week10.pl' for inclusion (include_path='.:/opt/alt/php73/usr/share/pear') in <b>/home/u681245571/domains/studyglance.in/public_html/labprograms/sdcdisplay.php</b> on line <b>113</b><br />

Output:

<br />
<b>Warning</b>:  include(ai/outputs/w10.txt): failed to open stream: No such file or directory in <b>/home/u681245571/domains/studyglance.in/public_html/labprograms/sdcdisplay.php</b> on line <b>165</b><br />
<br />
<b>Warning</b>:  include(): Failed opening 'ai/outputs/w10.txt' for inclusion (include_path='.:/opt/alt/php73/usr/share/pear') in <b>/home/u681245571/domains/studyglance.in/public_html/labprograms/sdcdisplay.php</b> on line <b>165</b><br />

Related Content :

Skill Development Course (PROLOG/ LISP/ PYSWIP) Lab Programs

1) Write simple fact for following: A. Ram likes mango. B. Seema is a girl. C. Bill likes Cindy. D. Rose is red. E. John owns gold View Solution

2) Write predicates one converts centigrade temperatures to Fahrenheit, the other checks if a temperature is below freezing. View Solution

3) Write a program to solve the Monkey Banana problem View Solution

4) WAP in turbo prolog for medical diagnosis and show the advantages and disadvantages of green and red cuts. View Solution

5) Write a program to solve 4-Queens problem View Solution

6) Write a program to solve Traveling salesman problems View Solution

7) Write a program to solve water jug problems using Prolog View Solution

8) Write simple Prolog functions such as the following. Take into account lists which are too short. -- remove the Nth item from the list. -- insert as the Nth item. View Solution

9) Assume the prolog predicate gt(A, B) is true when A is greater than B. Use this predicate to define the predicate addLeaf(Tree, X, NewTree) which is true if NewTree is the Tree producedby adding the item X in a leaf node. Tree and NewTree are binary search trees. The empty treeis represented by the atom nil. View Solution

10) Write a Prolog predicate, countLists(Alist, Ne, Nl), using accumulators, that is true when Nl is the number of items that are listed at the top level of Alist and Ne is the number of empty lists. Suggestion: First try to count the lists, or empty lists, then modify by adding the other counter. View Solution

11) Define a predicate memCount(AList,Blist,Count) that is true if Alist occurs Count times within Blist. Define without using an accumulator. Use "not" as defined in utilities.pro, to make similarcases are unique, or else you may get more than one count as an answer. View Solution