STUPID MATH QUESTION!!!
So we had a question in math class. the question was something like "Your friend has started a new job. he tells you he earns 18. what do you think he earns?".. what do you think he earned? $18. 1,800, 18 million or 18 thousand. It gives no other information than that. You can't have something different than that. which one is the right answer?
Comments
Anyway, to your question I would recomend being a smartass, saying "$18 an hour? Thats barly over the living wage!" But then, it's most likely he's saying 18,000$ (Ta eddie). Depends, any idea where he works?
Money.
its a multiple choice question so can't be a smartass.
18 euro's
1800 euro's
18000 euro's
18 million euro's
and its multiple choice.
I get the feeling that there is some information missing that went along with the specific wording of the question. You can always write-in that there was insufficient information, if not. Safe answer is $18,000, with a write-in '/yr'.
I'd more be questioning how this is a math question, though.
At best it's a rough estimation of scope, which requires more context than has been provided.
Here in the netherlands, the mean gross income is around 33.000 Euro's per year. 18eu per hour is a decent wage, which should get close to that annual amount. But! That would be too much for a job starter.
So, what you need to know is what the mean income in your country is and go from there, I think.
You are tasked with finding which is the highest floor you can drop the eggs off of before they will break. You want to do this in the least number of tries possible and without running out of eggs before you determine the correct floor.
Both eggs behave identically, neglect terminal velocity, falls that don't break the eggs do not disrupt their stability.
What would be your methodology? (no points for saying start at floor 1 then 2 then 3 etc)
What is the MAX number of tries it would take to determine the correct floor?
If the building was 10,000 stories tall how many eggs would you need for this method?
logn
exactly, binary search
with a 10k stories tall u'd need log_2 10.000 , between 13 and 14
So for 100 stories you start at 10th floor, then go to 20th, then 30th etc until the egg breaks.
If it breaks on the 40th floor for example, you take your last egg and drop if from floor 31, then 32, then 33 etc.
So, worst case scenario, the answer is floor 99. It takes 10 drops to reach floor 100 where the first egg breaks. Then it takes 9 drops from floor 91 to floor 99, 19 drops in total.
Building on that answer, a 10000 floor building could be done with 4 eggs. Worst case scenario the answer is floor 9999. That's 10 drops to reach floor 10,000(1000th, then 2000th, etc), 9 drops to reach floor 9900(9100,9200,9300...) , 9 drops to reach floor 9990 (9910,9920,9930...) and finally 9 drops to reach floor 9999 (9991,9992,9993 etc). 37 drops maximum.
This was the solution presented to me at least, It's possible there's a better way.
The binary search I wrote about is more efficient, at least for the worst case.
Worst case scenario for a 10k floors building is 14 eggs.
The point of this algorithm is to split your data block in two subsets and determine in which half the solution is.
You keep doing the same over and over until you find the exact solution.
Since this is an exponential decrease in the size of the input, the amount of steps needed to process this data grows logarithmically (since log is the inverse function of exp).
It works like this:
--Step 1
Test egg at 10k / 2 = 5000th floor.
If it breaks, test at 2500th floor
Else, test at 7500th floor.
// Let's suppose the egg did break.
--Step 2
Test egg at 2.5k/2 = 1250th floor.
If it breaks, test at 625th floor.
Else, test at 1875th floor.
And you keep doing this until you find the solution.
This algorithm has a complexity of O(log_2 n), meaning that the worst case scenario is base 2 log of the input size n (in this case n = 10k).
Hence:
MAX = ceil(log_2 10.000) = 14
Ah, stupid me, I totally ignored the impossibility of reusing eggs >.<
p.s. : epic profile picture!