how does galil substring finding algorithm work - algorithm

I read the galil-seiferas algorithm mentioned in book Handbook of Exact StringMatching Algorithms by Christian Charras and Thierry Lecroq in chapter 28.
according to algorithm the string must be decomposed to two parts but in the example there's no partitioning i think i did't understand the algorithm can any one explain it to me or give and example or at least give a resource.i have to represent it and really need it.giving an example could be very helpful.
tnx

Related

Why does the wikipedia implementation of Stoer-Wagner algorithm (for global min cut) give wrong answer?

I was studying Stoer-Wagner algorithm and I found a wikipedia implementation (which is the same as the one Stanford university uses in ACM ICP PDF). It states the cut is not correct but I don't understand why.
https://en.wikipedia.org/wiki/Stoer%E2%80%93Wagner_algorithm
Could you give me a hint? I don't understand the case it proposes...

Lagrange's four-square Implementation

I am learning about Lagrange theorem , According to which every number can be represent a sum of square , But how do i implement this algorithm , i have search the web but i could not find any relevant material on this. Can anyone help me implement this algorithm or provide some reference ?
It doesn't look like there's an easy answer for this. Here are some references I think will help, though.
https://math.stackexchange.com/questions/483101/rabin-and-shallit-algorithm
https://cs.stackexchange.com/questions/2988/how-fast-can-we-find-all-four-square-combinations-that-sum-to-n

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.

Create a sum of 1000, 2000, etc. from set of numers

Ok, so here's the problem:
I need to find any number of intem groups from 50-100 item set that add up to 1000, 2000, ..., 10000.
Input: list of integers
Integer can be on one list only.
Any ideas on algorithm?
Googling for "Knapsack problem" should get you quite a few hits (though they're not likely to be very encouraging -- this is quite a well known NP-complete problem).
Edit: if you want to get technical, what you're describing seems to really be the subset sum problem -- which is a special case of the knapsack problem. Of course, that's assuming I'm understanding your description correctly, which I'll admit may be open to some question.
You might find Algorithm 3.94 in The Handbook of Applied Cryptography helpful.
I'm not 100% on what you are asking, but I've used backtracking searches for something like this before. This is a brute force algorithm that is the slowest possible solution, but it will work. The wiki article on Backtracking Search may help you. Basically, you can use a recursive algorithm to examine every possible combination.
This is the knapsack problem. Are there any constraints on the integers you can choose from? Are they divisible? Are they all less than some given value? There may be ways to solve the problem in polynomial time given such constraints - Google will provide you with answers.

Resources