 |
|
|
|
 |
AndiH
Currently not available.
Registered: Jan 2001
Location: Regensburg, Germany | GTA #15
|
|
|
Re: Re: Re: Smart?
| quote: | Originally posted by Flyboy217
The "worst case" depends entirely on your algorithm. For example, if you decided to drop from 1, then 2, then 3, etc... then your worst case would be the 100th floor. It would take 100 tries in the worst case then. You need an algorithm whose worst case is minimal. |
No, in that case my worst case would be 99 since you said that the egg would break if dropped from the 100th floor. Also, now I assume that there's no ground floor?
|
|
Oct-10-2003 17:05
|
|
|
 |
 |
DigiNut
You kids get off my lawn!

Registered: Dec 2002
Location: Toronto, Self-proclaimed Centre of the Universe
|
|
|
Re: Re: Re: Re: Re: Re: Re: Smart?
| quote: | Originally posted by Flyboy217
I'll go one step further and tell you that you make a faulty assumption in your first sentence. Any more and I'd be telling you the solution. |
Ok, I think I've figured it out.
You drop the first egg at the 15th floor. If it breaks, you count up in sequence from 1 to 13 (14 drops).
Then you drop the next egg at the 29th floor. If it breaks, count up in sequence from 16 to 28 (again 14 total).
Keep going up to the 42nd, 54th, 65th, 75th, 84th, 92nd, and 99th floors, which gives you intervals of 11, 10, 9, 8, 7, etc. respectively, all with a total worst-case drop of 14.
So the worst case is 14.
Right?
I'd hardly call this an "elegant" solution though... it's not elegant unless you know it in advance.
___________________
My party schedule:
2009-02-21 - DJ Attention @ I'm So Popular
2009-06-18 - DJ Annoying @ People Need To Know Where I'll Be
2012-11-32 - DJ Insufferable ɸ Or At Least the Stalkers I Complain About
2048-06-66 - Spastic & Whocares ¶ Although I'm Actually Flattered
9999-45-81 - Tweaker Gimp ☼ I Probably Won't Even Go To This But I Have To Make Sure I Fill Up All The Available Space Here
|
|
Oct-10-2003 17:35
|
|
|
 |
 |
Flyboy217
Senior tranceaddict

Registered: Aug 2003
Location: In DEEP SPACE... Space... space... sp...
|
|
|
Re: Re: Re: Re: Re: Re: Re: Re: Smart?
| quote: | Originally posted by DigiNut
Ok, I think I've figured it out.
You drop the first egg at the 15th floor. If it breaks, you count up in sequence from 1 to 13 (14 drops).
Then you drop the next egg at the 29th floor. If it breaks, count up in sequence from 16 to 28 (again 14 total).
Keep going up to the 42nd, 54th, 65th, 75th, 84th, 92nd, and 99th floors, which gives you intervals of 11, 10, 9, 8, 7, etc. respectively, all with a total worst-case drop of 14.
So the worst case is 14.
Right?
I'd hardly call this an "elegant" solution though... it's not elegant unless you know it in advance. |
The worst case is indeed 14, but your solution is slightly flawed. Suppose the eggs break at 15. Then you try 15, find the egg breaks, and try 1-13 and it doesn't. You don't know whether the answer is 14 or 15 now. Instead, your first drop should be 14.
It extends nicely so that an M-story building requires N drops such that N(N-1)/2 = M. The fun part is understanding that your drops must decrease to balance out the worst case. Most people wrongly believe it must be constant. I sadly removed that joy for you :-P
|
|
Oct-10-2003 17:47
|
|
|
 |
 |
Abject Silver
Senior tranceaddict
Registered: Oct 2002
Location: Ottawa, Canada
|
|
|
i direct your attention to 'writing against your life' by richard mitchell, better known as the grammarian.
i love math just as much as the next guy, but uhh.... well, just read it, especially you intellects. you know who you are. it'll kick your asses to infinity and back before you can say 'MENSA!!!'
___________________
You're like a sight for sore eyes, lyrical and gentle, borderlining sentimental...
|
|
Oct-11-2003 04:50
|
|
|
 |
All times are GMT. The time now is 22:06.
Forum Rules:
You may not post new threads
You may not post replies
You may not edit your posts
|
HTML code is ON
vB code is ON
[IMG] code is ON
|
|
|
|
|
|
Contact Us - return to tranceaddict
Powered by: Trance Music & vBulletin Forums
Copyright ©2000-2026, Jelsoft Enterprises Ltd.
Privacy Statement / DMCA
|