Value of f in A* algorithm [closed] - algorithm

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
In A* algorithm, if g=0 and h=0 then what will be the result of f?
I know f(x)=g(x)+h(x). So it is true that f(x) will be zero?

f(x) would be 0.
But this should hardly ever occur.
g(x)=0 means you had no costs to reach x (should only be the case for the starting point)
h(x)=0 means the heuristics says that the costs to reach the goal from x costs not more than 0 (means that you are at the goal)
so f(x)=0 should only be possible if you start at the goal.

Related

Calculating Probability of (m or more) consecutive successes [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Number of independent trials is N, probability of success is p. I want to calculate
Probability of m consecutive successes.
Probability of m or more consecutive successes.
The numbers are very large, so the algorithm should be highly optimized.
N = 877646440
m = 79279,
p = 6204/6205 (or 0.999838839645447....)
I seem to have the answer on mathematical SE where I originally started this question. https://math.stackexchange.com/questions/1888887/easily-calculable-minimum-probability-for-m-or-more-consecutive-outcomes/1889372#1889372
I will implement that solution and update the questions.
Edit: I have gotten the answer on the mathematical SE question and implemented the solution.
Thanks

Design a Greedy algorithm for this preblem [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
In the interval covering problem, we are given n intervals
[s1,t1), [s2,t2), ···, [sn,tn)
such that
S i∈[n][si,ti) = [0,T).
The goal of the problem is to return a smallest-size set
S ⊆ [n]
such that
S i∈S[si,ti) = [0,T).
Design a greedy algorithm for this problem.
A greedy algorithm could be devised as follows. As long as there is a point p in [0,T) which is not contained in one of the already selected intervals, select an interval [s_i,t_i) , which must exist, since the union of all [s_i,t_i) is [0,T) as stated in the requirements. As the set of intervals [s_i,t_i) is finite, this procedure must terminate.

Find number of integral solution of 1/x+1/y=1/Nfactorial [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
This question is a practice problem on interviewstreet.com.
Find number of integral solution of 1/x+1/y=1/N! for a given N
For N=1 answer is 1.
I tried to solve this questions , but cant predict from where to start. I am not from math background.
I am looking for the approach , how should I proceed towards the solution.
Is there any direct formula for this?
Try to solve it as a iterative problem. All the solutions of N-1 are also valid for N. The only uncovered solutions are where x and y are both not divisible by N, which should be easier to count.

Cannot understand the problem of Bitonic Euclidean Traveling-Salesman [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I am referring to the problem in Introduction to Algorithms. I kind of fail to understand the problem.
From what I see, I need to sort the x-coordinates of the given set of points and then form a optimal path from the smallest x coordinate to the largest x coordinate.
For eg. (x1,y1) (x2,y2) ...(xn,yn) are sorted points. The optimal path is x1-x2-x3...xn.
What am I missing here? How does dynamic programming come into picture here?

how is calculated gcd of 4 number? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
does gcd(gcd(a,b),gcd(c,d)) equal gcd(a,b,c,d)?or how can i calculate gcd of 4 number?
yes that is correct. If you are finding the gcd of (a,b,c,d) then any split should work. So gcd(a,b,c,d) = gcd(gcd (a,b) , gcd(c,d))
Yes. GCD(a,b,c,d) = GCD(a, GCD(b, GCD(c, d))) (or any other order, its associative and commutative.) Oh, and just in case you didn't know, you can use the Euclidean algorithm to compute GCD very quickly.

Resources