Design a Greedy algorithm for this preblem [closed] - algorithm

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.

Related

Value of f in A* algorithm [closed]

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.

Find a subset of intervals with minimum total cost which together still cover the initial interval [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 3 years ago.
Improve this question
Suppose we are given n intervals [xi;yi] for 1 <= i <= n, which together cover an interval [x0;y0]. Each interval [xi;yi] has a positive cost ci. Give an efficient algorithm to find a subset of intervals with minimum total cost which together still cover the interval [x0;y0].

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

Optimal Seat Allocation Algorithm [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 8 years ago.
Improve this question
I am looking for an optimal seat allocation algorithm, such that for example, if i have a cinema with capacity 100, and n groups of people, i want to choose the right groups that will fill in as maximum seats as possible.
The only thing that will work is brute force, but I'm sure there must be cleverer ways to do that. Any ideas?
This is a special case of the Knapsack problem known as the Subset Sum problem. There is a lot of work already done on this so the wiki article is a good jumping off point discussing many possible algorithms. The correct choice in algorithm will depend on the sort of data you’re operating on.

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.

Resources