Prolog program

Assignment Help Basic Computer Science
Reference no: EM13547577

Prolog program
1- Write a Prolog program for solving the crypt-arithmetic puzzle AM + PM = DAY. That is, write predicate solve([A, M, P, D, Y]) which binds each of the variables [A, M, P, D, Y] with values from 0 to 9 such that it satisfies the equation AM + PM = DAY. Make sure that all the variables have a different value assignment and A, P, D cannot take the value 0.


2- Write a Prolog program for performing Merge Sort. That is, write predicate mergesort(L, R) which succeeds when R is the sorted (using merge sort) list for the input list L. [HINT: First split L into two halves say L1 and L2. Then recursively mergesort L1 to get R1 and L2 to get R2. Now merge R1 and R2 to get R (remember that R1 and R2 are sorted).]

Reference no: EM13547577

Questions Cloud

Write a literature review - develop a research question : Draw on the additional resources for course for guidance in understanding the concepts
Round-robin scheduling is used to execute the processes : a) If round-robin scheduling is used to execute the processes, how many items will each process have produced and consumed at the end of 10 time quanta? Assume that the initial run queue order is P1, P2, P3, C1.
Estimate the average power delivered to the entire circuit : A series ac circuit contains a 350 ohm resistor, a 17.0 mH inductor, a 3.10 uF capacitor, Find the average power delivered to the entire circuit
How far behind the mirror is the image located : An object that is 35 cm in front of a convex mirror has an image located 20 cm behind the mirror. How far behind the mirror is the image located
Prolog program : Prolog program
Estimate the normal force exerted by the floor on each hand : Assume L1 = 0.844 m and L2 = 0.401 m. Calculate the normal force exerted by the floor on each hand
Create a view that lists the isbn and title for each book : Create a view that lists the ISBN and title for each book in inventory along with the name and phone number of the person to contact if the book needs to be reordered. Name the view REORDERINFO
A modem that uses qam-64 modulations. : My ADSL provider's twisted-pair lines provide a total bandwidth of 1.1M hertz and the provider provides me with a modem that uses QAM-64 modulations.
Transport layer : Transport layer

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Calculate net pay and totals from the inputs provided

Write a program to calculate Net Pay and Totals from the inputs provided below. The program should use a loop & prompt user for inputs shown.

  Reads in three integers

Write a program that reads in three integers and determines and prints the smallest number numerically in the group. The values are NOT necessarily entered in numeric order.

  Explain bindings which are required to determine semantics

Write simple assignment statement with one arithmetic operator in some language you know. For each component of statement, write various bindings which are needed to determine semantics.

  Categorize each of them into the area

During the Sarbanes-Oxley audit of a financial services company, you note the following issues. Categorize each of them into the area to which they belong: IT change management, logical access to data, and IT operations.

  Mick''s wicks makes candles in various sizes

Mick's Wicks makes candles in various sizes. Create a class for the business named Candle that contains data fields for color, height, and price. Create get methods for all three fields

  Various algorithms for sorting an array of ints

In class and in the reading, we saw various algorithms for sorting an array of ints. The fastest ones -- among those whose base operation is to compare two elements -- ran in time O(N log N). In fact, unless you know something more about your data, y..

  Compare and contrast five design pattern activity

Design Pattern Activity: Prepare a 2-3 page paper comparing and contrasting five of the design patterns . Choose any five from the list. Adapter - helps to reuse an object or method by adapting its interface to a more common one

  What is the difference between the if then elseif

What is the difference between the If Then ElseIF clause and a Nested If Block? Please provide examples of how you would use each.

  Assume the sequence numbers are properly sized

What suggestions would you make to your colleague to fix the protocol? Assume the sequence numbers are properly sized.

  Why an organization prefer one approach over the other

As a system analyst, which would you prefer? Why? Can the two approaches be successfully combined? Explain. In all cases, support your analysis with specific examples from your readings, research, and professional experience (if applicable).

  Web design is the planning and production of web sites

Web design is the planning and production of web sites, including, but not limited to, technical development, information structure, visual design, and content design.

  He set of binary strings which are divisible

The set of binary strings which are divisible by 4 when interpreted as an integer value.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd