



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




You are given two jugs, a 4-gallon one and a 3- 3 - gallon one, a pump that has unlimited water that you can use to fill the jug, and the ground on which water may be poured. Neither jug has any measuring markings on it. How can you get exactly 2 gallons of water in the 4-gallon jug? To solve this, we must make some assumptions not mentioned in the problem. They are: ● We can fill a jug from the pump. ● We can pour water out of a jug to the ground. ● We can pour water from one jug to another. ● There is no measuring device available. Operators — we must define a set of operators that will take us from one state to another.
Explanation: The eight queens’ problem is a problem in which we figure out a way to put 8 queens on an 8× chessboard in such a way that no queen should attack the other. For basic info about the queen in a chess game, you should know that a queen can move in any direction (vertically, horizontally, and diagonally) and to any number of places. In the figure below you can see how to place 4 queens on a 4×4 chessboard. Similarly, we have to place 8 queens on an 8×8 chessboard. We will use backtracking to solve this interesting problem(puzzle). Backtracking Backtracking the solution of the problem depends on the previous steps taken. We take a step and then analyze it that whether it will give the correct answer or not? and if not, then we move back and change the previous step. Pseudocode START
Output: