Question:
You are given 100 stations and distance between each adjacent stations.
Now you have to select 10 stations(means 10 hops) among those 100 stations
in such a
way that maximum of distance between any 2 hops will be minimised.
By default 1 and 100 stations are selected , so you need to ch
I have been doing this question for a time but was not able to solve it. It
is based josephus problem ? Has anybody any idea
http://www.spoj.pl/problems/WTK/
--
*UTKARSH SRIVASTAV
CSE-3
B-Tech 3rd Year
@MNNIT ALLAHABAD*
--
You received this message because you are subscribed to the Google Group
http://www.geeksforgeeks.org/archives/503
here is O(n) soln.
On Thu, Feb 9, 2012 at 1:15 AM, Prakhar Jain wrote:
> Hello everyone,
>
> suppose we have an array of size n and a number, say x, and we have to
> determine whether the number x is present in the array more then n/2 times
> or not
Hello everyone,
suppose we have an array of size n and a number, say x, and we have to
determine whether the number x is present in the array more then n/2 times
or not?
can we have an O(log n) algo for determining it..?..pls help...!!!
--
--
Prakhar Jain
IIIT Allahabad
B.Tech IT 3rd Ye
@Shashank: its LIS problem but desired complexity is : O(k*n*logn)
On Wed, Feb 8, 2012 at 11:51 PM, WgpShashank wrote:
> @atul , its application of LIS & LCS problem , isn't it ?
>
>
> Thanks
> Shashank
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algori
Here is an DP solution:
(consider only simple graph, with at most 1 line between any 2 distinct
points, and no point connect to itself)
Suppose f(n,m) is the number of ways m lines can connect n points.
Then f(n,m) = 0 when m < n-1 or m > n(n-1)/2;
For graph with n vertices and m edges (conne
@Sravanreddy001: Add curly braces...
swap(a,b,c) {c t;t=a;a=b;b=t;}
Dave
On Feb 8, 1:28 pm, sravanreddy001 wrote:
> @Dave:
>
> you mentioned that there is a way to fix the issue caused by calleing
> swap(t,u,int) -- how can we fix this in preprocessor directive?
--
You received this message b
@Dave:
you mentioned that there is a way to fix the issue caused by calleing
swap(t,u,int) -- how can we fix this in preprocessor directive?
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To view this discussion on the web visit
https://g
@Don:
thank you.
each possible arrangement of lines can be done in (n-1)! ways.. and only
one is needed of it.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeek
The approach of adding one edge connecting a connected point to an
unconnected point will produce every possible set of n-1 edges which
connect all the points, but it will include duplicates, because it can
generate all of those edges in any order. There are (n-1)! possible
orders that the same set
@atul , its application of LIS & LCS problem , isn't it ?
Thanks
Shashank
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/x2c4hvfZCuUJ.
To post to this gr
@Don:
I had the similar approach, but I didn't think of "dividing by (n-1)!"
Why is this needed? -- I think this is to avoid the cases in which, just
the order of picking the nodes is different and lines drawn are same.
How is this (n-1)! -- i might be missing the the very basic thing.. plz
cor
On Wed, Feb 8, 2012 at 8:53 PM, Shalini Sah wrote:
> http://www.spoj.pl/ARHN/
> 10,000 at stake
>
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group
http://www.spoj.pl/ARHN/
10,000 at stake
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
F
Let's start with n-1 lines
Build up the edges like this:
Start by connecting any point to any other point. There are n*(n-1)/2
ways to do this.
Then add edges from a connect point to an unconnected point. For the
first edge added this way, there are 2*(n-2) options. After that it is
3*(n-3), 4*(n-4
hi,
I am trying the following problem, but not getting the logic...
http://www.codechef.com/problems/CHEFBRO
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from
Hi All,
can there be a formulato which we can estimate how many ways (n-1)
lines can connect n points in the same way how many ways n lines can
connect n points and so onthere is one way that we store the
information in adjacency list or in adjacency matrixand will check
for the same f
17 matches
Mail list logo