I think a lot of people failed on ternary search because they failed
to correctly consider the case where the centre of mass is not moving.
In this case, all inputs to the function evaluate to the same output,
so the position you converge to depends on how you coded the
algorithm.

On Sep 14, 9:33 am, rajatag12 <[email protected]> wrote:
> > This was more of a physics problem than an algorithm question. I was
>
> With little bit of physics, some algorithmic knowledge was sufficient
> to solve this problem.
>
> > You just need to find the position and velocity of the center of mass (COM).
> > You can do this by finding the average position (p) and average velocity (v)
> > of the flies by summing them and dividing by N. ...
>
> Yes this was required.
>
> > ........ Then you may apply d2 and t
>
> This was an individual's choice :
>
> 1) Either differentiate and form the equation and solve it.
> (Mathematical)
> 2) Or opt for "Ternary Search" approach. (Algorithmic)
>
> Whichever the user feels comfortable with.
>
> I preferred to go with 2nd option (Ternary Search). Only that instead
> of averaging out the center of mass and velocities of flies first and
> then tracking the position of the center of mass, i calculated the
> position of the center of the mass of the flies for each time instant.
> While i think it should have worked right like other approaches, it
> didnt.
>
> - Rajat.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to