Popular posts from this blog
C# program to convert Decimal Number to Hexadecimal
Conversion of Decimal To Hexadecimal Number in C# This C# Program Performs decimal to Hexadecimal Conversion. This C# Program converts the given decimal number into hexadecimal. Store the decimal value in other variable (quotients) and store its modulo in temporary variable. Now compare the value of temporary variable. If it is less than 10 add 48 to it or else add 55 to it. and at last print the result. Here is source code of the C# Program to Perform Decimal to Hexadecimal Conversion. The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.
Water Jug Problem using Depth First Search
Problem Statement: In a Water Jug Problem you are given two jugs, one 4-gallon and one 3-gallon, a pump which has unlimited water which 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? This problem can be solve using multiple techniques of Artificial Intelligence (AI). Here we are going to solve the Water Jug Problem using the Depth First Search (DFS) Algorithm. To solve the problem with Breath First Search (BFS), check it here. Here is the code for the current problem statement. Firstly, let include all the header files. Now we have to define a structure for the nodes which we are going to use it for the further process. Below code snippet of code is for the same. #include<stdio.h> #include<conio.h> struct node { int x, y; struct node *next; }*root, *left, *right; Now we have to check weather the node whi...
Comments
Post a Comment