[algogeeks] Re: Dynamic Programming Algorithm for "swim relay team"

2008-01-12 Thread gurbinder dhillon
Hi, There are five segments in c:- 1.Data Segment 2.Code Segment 3.Stack Segment 4.Bss segment 5.Heap segment Can any one explain what things are stored in which segment when a c program actually runs? I have read that uninitialized and initialized global variables are stored in bss and stack segme

[algogeeks] Re: Dynamic Programming Algorithm for "swim relay team"

2008-01-12 Thread tu4me2007
Hi I have a simmilar Problem , and was wondering if you can elaborate on the funktion , sorry I am a starter and I need a bit more explainations ... f(P1,P2, P3,...Pn) ,,, How can I implement it in Java ,... Thank you Samuel On 6 Jan., 08:10, Satish <[EMAIL PROTECTED]> wrote: > We can used

[algogeeks] Re: Dynamic Programming Algorithm for "swim relay team"

2008-01-07 Thread hc busy
Well, actually that only solves for when the # of players and events are same, what if there're more players than events? The recursion you describe has exponential growth rate. f(c) for some set of P's can't really be cached, because the number of possible c's is just are huge as exponential.

[algogeeks] Re: Dynamic Programming Algorithm for "swim relay team"

2008-01-05 Thread Satish
We can use dynamic programming here to find out the team configuration with minimum time. Define a function f(P1,P2, P3,...Pn) that returns the players sequence (given n players for n rounds, which swimmer swims at which position) that would return the total minimum time. Then f() can be defined

[algogeeks] Re: Dynamic Programming Algorithm for "swim relay team"

2008-01-03 Thread hc busy
At risk of stating the incredibly obvious, or giving away answer to a fun interview question. The naive but correct algorithm that gives the solution will have tried every combination M of K swimmers in M events. which will give you K!/(K-M)! arrangements, and the algorithm would then compare the