GDIFF and BSDIFF algorithm needed - difference

i could not find the working algorithm of the above two ,so can anyone provide me on how GDIFF and BSDIFF works?

Related

Confusion in search algorithms in AI

I'm studying Artificial Intelligence in my University..
I've to submit project..
In which I've to solve popular pancake problem, and I've to get search result using BFS,DFS,UCS,Greedy (heuristic),A*(admissible)..
One more requirement is, I've to find the Solution , optimal solution , Is my solution is optimal or not?..
The question is, there is some algs who don't search optimal path.. so when I use those to get result.. how can I know what was the optimal path so that I can compare my result????
Any suggestions??
Solution is A Node (object of node class)
Node class Having variables (state, cost, parentNode, Depth)
To be clear, not all of the algorithms that you named can find the optimal solution. For example, in the greedy search, it might be found some solution for the problem, but it might not be optimal. However, some of the algorithm will find the optimal solution such as A*. So steps like the following:
1. Run all algorithms and find the solution
2. Base on the result of one algorithm (like A*) specify the optimal solution
3. Then compare the result of other algorithms with the optimal solution

Precalculate Result of A*

Currently learning about the A* search algorithm and using it to find the quickest solution to the N-Puzzle. For some random seed of the initial starting state, the puzzle may be unsolvable which would result in extremely long wait times until the algorithm has search the entire search-space and determined there is not solution to the give start state.
I was wondering if there is a method of precalculating whether the A* algorithm will fail to avoid such a scenario. I've read a bit about how it is possible but can't find a direct answer as to a method in which to do it.
Any guidance or options are appreciated.
I think A* does not offer you a mechanism to know whether or not a problem is solvable. Specifically for N-Puzzle, I think this could help you to check if it can be solved or not:
http://www.geeksforgeeks.org/check-instance-8-puzzle-solvable/
It seems that if you are in a state where you have an odd amount inversion, you know for sure the problem for that permutation is infeasible.
For the N-puzzle specifically, there are only two possible parities, so you just need to check which parity the current puzzle is.
There is an in-depth explanation on how to do this on the math stackexchange
For general A* problems, no, there is no way to pre-compute if the graph is solvable.

HackerRank Maximum Disjoint Subtree Product

Can anybody give me a better explained insight about the problem Maximum Disjoint Subtree Product (link here) ?? I can't figure it out from the psetter analysis.
I don't understand 2nd DFS approach (it tries to calculate the solution for "up subtrees"??)
Please can someone help me and/or give me other problems following the same solution approach ??? I really appreciate other problems like this one. Thanks in advance :D
It seems like a dynamic programming problem. Check out this link before, it contains great tutorial on problems that involve dynamic programming on Trees.

Solving puzzle with tree data structure

I am currently following an algorithms class and we have to solve a sudoku.
I have already a working solution with naive backtracking but I'm much more interest in solving this puzzle problem with a tree data structure.
My problem is that I don't quite understand how it works. Is anyone can explain to me the basic of puzzle solving with tree?
I don't seek optimization. I looking for explanation on algorithms like the Genetic algorithm or something similar. My purpose only to learn at this point. I have hard time to take what I read in scientific articles and translate it on real implementation.
I Hope, I've made my question more clear.
Thank you very much!
EDIT: I edit the post to be more precise.
I don't know how to solve Sudoku "with a tree", but you're trying to mark as many cells as possible before trying to guess and using backtrace. Therefore check out this question.
Like in most search problems, also in Sudoku you may associate a tree with the problem. In this case nodes are partial assignments to the variables and branches correspond to extensions of the assignment in the parent node. However it is not practical (or even feasible) to store these trees in memory, you can think of them as a conceptual tool. Backtracking actually navigates such a tree using variable ordering to avoid exploring hopeless branches. A better (faster) solution can be obtained by constraint propagation techniques since you know that all rows, columns, and 3x3 cells must contain different values. A simple algorithm for that is AC3 and it is covered in most introductory AI books including Russell & Norvig 2010.

Lexicographically smallest perfect matching

I want to find the lexicographically smallest perfect matching in two partial graphs. I'm supposed to use Kuhn's algorithm, but I don't understand how to make matching lexicographically smallest. Is it at all possible in Kuhn's algorithm? I can provide my code, but it's classic enough.
As a hint, consider how you could determine where just the first node should be matched in the lex-min matching.
In most cases like this it is usually easier to make a reduction instead of modifying the algorithm:
Find a way to change the input in your problem so that lexicographical order breaks any ties (but in a manner that perfect matchings still have a higher score than imperfect ones)
Run the modified graph through Kuhn's algorithm.
If needed, translate the answer back to the original problem.
I haven't tried to actually solve this myself or read the problem in detail. But this seems to be a textbook exercise and I feel this answer is enough :-)
Think about how you can create assignment prices that encourage lexicographically early matchings.

Resources