I am studying the marzullo's algorithm that behind the NTP protocol, but the equation(11) seems wrong? It said that the sign of the last term is negative.
... - (t_r - t - \xi) * \sigma
But to me, it seems that this should be a positive term as it is derived from lemma I?
The proof details may be messy(but not difficult), so I don't put here. If you are familiar with this paper, may be you can tell me where I am wrong.
Many thanks!
Related
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.
I have developed a recursive formula for knapsack problem on my own without any knowledge of present solutions. Please tell me whether it is right or wrong and correct it.Thanks in advance.
B(S) = max (B (s-w(i)) + b(w(i)) )
for all i belonging to n;
notations are as usual . S is capacity,B is the answer to knapsack.
I do not want to give you straight answer, but to direct you on the flaws of your formula, and let you figure out how to solve them.
Well, if you do not address the value, something must be wrong - otherwise, you just simply lose information. If you chose to "take" the item (B(s-w(i))) what happens to the current value?
In addition, what is i? How do you change i over time?
When talking about recursive formula, you must also mention a stop clause for it.
I already solved a bisection algorithm using C++ as a language, I think the main purpose is to find the root.
I understood the whole algorithm, but I didn't understand what the root will do or what will be the the purpose of root if we find it.
In mathematics, a root (or zero) of function f is a value of x where f(x) = 0.
For example, the function f(x) = x^2 - 4 has two roots: x=2 and x=-2.
For more information, see Wikipedia.
For some applications (for polynomials), see https://math.stackexchange.com/questions/83837/what-is-a-real-world-application-of-polynomial-factoring
Remember the many times you were asked to find out some value by solving an equation? Well, to find a root is another way of saying "solve the equation." The advantage of methods like this is that they give answers even for truly horrible equations, where the techniques taught in school have no chance to give answers.
First, yes it's my HW and I find it hard so I'll really appreciate some guidance.
I need to prove that for denomination of 1,x,x2...xn when x>=1 the greedy algorithm for the coins problem always work .
We will always get the amount of money we need in minimal coins number when we always pick the maximal coin that smaller from the amount.
Thank you.
As this is your homework I will not provide a complete answer but will rather try to guide you:
First as it usually happens for problems of that type try and prove for yourself that the statement is true for the first few natural numbers. Try to summarize what you use to make the proof for them. This usually will give you some guidance of the correct approach.
I would use induction for this one.
Another option that might help you - represent all the numbers in numerical system with base x. This should make it clearer why the statement is true.
Hope this helps you.
There is a question in TAOCP vol 1, in "Notes on Exercises" section, which goes something like:
"Prove that 13^3 = 2197. Generalize your answer. (This is a horrible kind of problem that the author has tried to avoid)."
Questions:
How would you actually go about proving this ? (Direct multiplication is one way, another way could be using formula of (a+b)^3). Does the solution requires using some method that will allow us to make some kind of generalization ?
What is the generalization here ?
Why is this a horrible kind of problem ?
What are some other kind of similar horrible problems that you are aware of ?
Appreciate any answers.
P.S. I apologize if the statement of problem above makes it look like a homework problem, but its not. Request people to not tag this as a homework problem, so that more people can give answers.
I'd guess that he's alluding to perhaps proving it starting from just the Peano axioms. Then constructing the integers, and going on to formally show that 13^3 = 2197 is a natural, logical conclusion that flows from the definition of exponentiation.
We could generalize to show that given an a and b, there exists some integer c, that is a^b.
This is a horrible kind of a problem because most people find it uninteresting.
Similar sorts of problems can be found in a course on analysis (along with some greatly more interesting).
I initially considered it as follows:
n3 = n * n * n
logn(n3) = logn(n*n*n)
logn(n3) = logn(n) + logn(n) + logn(n)
3 = 1 + 1 + 1
3 = 3
This seems fairly circular in its use of logarithmic identities, but given where I'm at in my algorithms research, it was oddly comforting.
Got stuck at the same exercise and 'solved' it this way:
a^b = mult(i=1 to b) a
After a bit of thinking I came to the conclusion that this is a prime factorization (both 13 and 3 are primes). Look up fermat's little theorem.
(I know, it's an old thread but maybe this'll help somebody who is also seeking an answer to this execise.)