exercices

advertisement
CS 360 Lab 4, Practice Part
Name:
Solve Problems 1-3. Each Problem counts for 3 points.
Download the Lab files from tux: /home/au49/public_html/cs360/winter14/lab4
Language Reference Guides: https://www.cs.drexel.edu/~au49/cs360/winter14/
1.) (Group) In Prolog, load the file gcd.pl. It contains a prolog predicate for finding the
greatest common denominator of two numbers. Find the GCD of 26 and 21.
[Insert screenshots of the output]
(Individual) Describe the computational complexity of the provided Prolog gcd code and
compare it with the computational complexity of the Euclid's algorithm.
2.) (Group) In Prolog, load the file last.pl. Demonstrate that the last1 predicate works
correctly.
[Insert screenshots of the output]
(Individual) What Prolog data structures and language features are used in the provided
code? What is the target of its computation?
3.) (Group) In Prolog, load the file merge.pl. Demonstrate that the mergesort predicate
runs correctly.
[Insert screenshots of the output]
Download