Fwd: [algogeeks] Re: Design an algorithm

2010-09-30 Thread Rashmi Shrivastava
@ Modeling Expert,,thanx -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options,

[algogeeks] Re: Design an algorithm

2010-09-30 Thread Modeling Expert
use array/vector of int to store value. E.g. if you want to store value : 23451023456678, you can't in a normal int or long but You can have int array /vector , say "int A[SIZE] " or " vector A(SIZE,0) A[0] 78 A[1] 66 A[2] 45 .. .. I have coded this long back to calculate factorial of big n

[algogeeks] Re: design an algorithm

2006-04-03 Thread Padmanabhan Natarajan
very similar to TSP. A standard textbook problem :-)On 4/3/06, sarinarpit <[EMAIL PROTECTED]> wrote: a directed Hamiltonian cycle DHC in a directed graph G+(V,E) is adirected cycle of length n=|V|,where |V|  is the number of vertices in G.So, the cycle goes through every vertex exactly once and the

[algogeeks] Re: Design an algorithm

2005-12-04 Thread Vishal
There are two more solutions.Let the common computer be called Master and others be called slaves.1.  The master maintains a min-priority queue and asks for the smallest number from each slave. It then deques one number from the queue and asks for the next smallest number from the slave which origi

[algogeeks] Re: Design an algorithm

2005-12-02 Thread pramod
In my algo, this O(N) space restriction is not violated. Each computer uses O(N) space only. But overall, all the N computers use O(N^2) space.

[algogeeks] Re: Design an algorithm

2005-12-02 Thread Abhi
one of the restriction is that a computer can only hold O(N) integers.

[algogeeks] Re: Design an algorithm

2005-12-01 Thread pramod
No, each computer after getting the median of medians, partitions the numbers it has and sends two values to the dedicated computer. Those two values of number of elements which are less than the median of medians and number of elements that are greater than the median of medians. Now the dedicat

[algogeeks] Re: Design an algorithm

2005-11-30 Thread Vijay Venkat Raghavan N
Hi, So do u mean to say that we can leave out those numbers which are less than the median of medians and greater than the median of medians in each round? If yes, I have a case to prove this algo wrong. -VijayOn 12/1/05, pramod <[EMAIL PROTECTED]> wrote: Let M1,M2, ..., MN be the medians and let

[algogeeks] Re: Design an algorithm

2005-11-30 Thread HalFas`
what means O(n) time ? I don't get... Vijay Venkat Raghavan N wrote: Hi pramod, I dont get the last part of your solution. How does it leave us with n^2/4 lesser and greater than the median? Also if we leave out everythng thats lesser or greater than a number, all what should be left is th

[algogeeks] Re: Design an algorithm

2005-11-30 Thread pramod
Let M1,M2, ..., MN be the medians and let MM be the median of medians. So (N-1)/2 medians are less than MM and (N-1)/2 medians are greater than MM. Since each of these medians has (N-1)/2 elements less and greater than themselves within each computer, there are (N-1)/2*(N-1)/2 (this is I mention

[algogeeks] Re: Design an algorithm

2005-11-30 Thread Vijay Venkat Raghavan N
Hi pramod, I dont get the last part of your solution. How does it leave us with n^2/4 lesser and greater than the median? Also if we leave out everythng thats lesser or greater than a number, all what should be left is the number itelf. I am missing something and plz explain your algo's last part

[algogeeks] Re: Design an algorithm

2005-11-30 Thread pramod
Each computer finds the median of the numbers it holds. This can be done in O(n) time and O(n) space by each computer. Now all computers send their median to a dedicated computer which finds the median of these medians ( O(n) time and space) and sends this value to all the computers. Each compute