RE: [algorithms-and-data-structures] Algorithms Meetup Problem #4

From: Kervin P.
Sent on: Monday, August 2, 2010 5:09 PM
Added a C# solution for problem 3 to Github.

Seems to match inputs 1 to 5 when I've done them by hand.

Best regards,
Kervin


Adevsoft Web Development
http://adevsoft.c...­


-----Original Message-----
From: [address removed] [mailto:[address removed]] On Behalf Of Deepankar
Sent: Saturday, July 31,[masked]:59 PM
To: [address removed]
Subject: Re: [algorithms-and-data­-structures] Algorithms Meetup Problem #4

btw just wanted to remind people to submit solutions for problem 0003.
I wanted to cross check my solution with someone else.

On Sat, Jul 31, 2010 at 3:58 PM, Deepankar <[address removed]> wrote:
> Ive subitted a solution by doing a checkin into the github repository.
>
> On Sat, Jul 31, 2010 at 3:34 PM, Kervin <[address removed]> wrote:
>> I'm not sure it's a complete solution but I've got a solution for problem 4 ( C# ) but I'm not being allowed to commit.
>>
>> Do I need to get special commit access?
>>
>> Best regards,
>> Kervin
>>
>>
>> Adevsoft Web Development
>> http://adevsoft.c...­
>>
>>
>> -----Original Message-----
>> From: [address removed] [mailto:[address removed]] On Behalf Of Andy Pliszka
>> Sent: Saturday, July 31,[masked]:52 AM
>> To: [address removed]
>> Subject: [algorithms-and-data­-structures] Algorithms Meetup Problem #4
>>
>> Hi,
>>
>> I would like to express my gratitude and thanks to YangXikun,
>> Deepankar, MichaelMellinger, SamSandberg, fjania, and dawgmatix for
>> solving and uploading code to our Github repository. We have solutions
>> in Java, Python, PHP, Lisp, and pseudo code. Great job! We need C,
>> C++, Scala, Ruby, Ocaml, and Haskell.
>>
>> Please, follow AlgorithmsNYC on Twitter
>> (http://twitter.co...­), so we can follow each other and
>> expand community.
>>
>> I would like to encourage everyone to start using our Meetup's email
>> list and forums to share problems and ask questions.
>>
>> Here is our next "Problem of the week". Please, upload your solutions
>> to our Github repository
>>
>> http://github.com...­
>>
>> Thanks,
>> Andy
>>
>> --------------------­--------------------­--------------------­--------------------­--------------------­----------
>>
>> Problem Statement
>>
>> You may remember an old computer game called "The Incredible Machine".
>> It was a game where you could simulate simple processes like balls
>> falling, lasers shooting, or cats pursuing mice. Moreover, you were
>> able to perform these observations with different values for
>> gravitational acceleration.
>>
>> Imagine a system with some unknown acceleration of gravity. There are
>> N balls, each fixed initially at some height above the ground. You are
>> given a int[] height, where the i-th element is the height of the i-th
>> ball above the ground. At time 0, the first ball is set loose and it
>> starts falling. When it reaches the ground, the second ball is
>> instantly set loose, and so on. This continues until the last ball
>> reaches the ground at time T.
>>
>> Return the acceleration of gravity in this system. Neglect air
>> resistance and any other resisting factors. The distance d travelled
>> by an object falling for time t with no initial velocity in a system
>> with gravitational acceleration g and no resisting factors is equal to
>> d = 0.5 * g * t^2.
>>
>> Definition
>>
>> Class: ?IncredibleMachineEa­sy
>> Method: gravitationalAcceler­ation
>> Parameters: ? ? int[], int
>> Returns: ? ? ? ?double
>> Method signature: ? ? ? double gravitationalAcceler­ation(int[] height, int T)
>> (be sure your method is public)
>>
>>
>> Notes
>> - ? ? ? The returned value must have an absolute or relative error less than 1e-9.
>>
>> Constraints
>> - ? ? ? height will contain between 1 and 50 elements, inclusive.
>> - ? ? ? Each element of height will be between 1 and 100, inclusive.
>> - ? ? ? T will be between 1 and 100, inclusive.
>>
>> Examples
>>
>> 0)
>>
>>
>> {16,23,85,3,35,72,96­,88,2,14,63}
>>
>> 30
>>
>> Returns:[masked]
>>
>> That's an acceleration of gravity that might be somewhere on Earth's surface.
>>
>> 1)
>>
>>
>> {6,6,6,6,6,6,6,6,6,6­,6,6,6,6,6,6,6,5}
>>
>> 12
>>
>> Returns:[masked]
>>
>> And this is likely on Jupiter.
>>
>> 2)
>>
>>
>> {8,8}
>>
>> 3
>>
>> Returns:[masked]
>>
>> That's a light one.
>>
>> 3)
>>
>>
>> {3,1,3,1,3}
>>
>> 12
>>
>> Returns:[masked]
>>
>> You could nearly fly under such conditions.
>>
>>
>>
>> --
>> Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
>> http://www.meetup...­
>> This message was sent by Andy Pliszka (andy+[address removed]) from Algorithms and Data Structures.
>> To learn more about Andy Pliszka, visit his/her member profile: http://www.meetup...­
>> To unsubscribe or to update your mailing list settings, click here: http://www.meetup...­
>> Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]
>>
>>
>>
>>
>> --
>> Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
>> http://www.meetup...­
>> This message was sent by Kervin ([address removed]) from Algorithms and Data Structures.
>> To learn more about Kervin, visit his/her member profile: http://www.meetup...­
>> To unsubscribe or to update your mailing list settings, click here: http://www.meetup...­
>> Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]
>>
>
>
>
> --
> Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
> http://www.meetup...­
> This message was sent by Deepankar ([address removed]) from Algorithms and Data Structures.
> To learn more about Deepankar, visit his/her member profile: http://www.meetup...­
> To unsubscribe or to update your mailing list settings, click here: http://www.meetup...­
> Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]
>
>



--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
http://www.meetup...­
This message was sent by Deepankar ([address removed]) from Algorithms and Data Structures.
To learn more about Deepankar, visit his/her member profile: http://www.meetup...­
To unsubscribe or to update your mailing list settings, click here: http://www.meetup...­
Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]

Our Sponsors

  • Pivotal Labs

    Pivotal Labs

  • Vendavo

    Vendavo is the leader in front-line profit optimization

  • Wolfram Research

    Mathematica is the world's ultimate application for computations.

  • Yodle

    Local online advertising for small businesses.

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy