andrew1
Joined 18 years ago
Joined 18 years ago
Surely it depends on the job. Maybe it's paying twice as much as Google/Apple/Microsoft for the same role.
If you don't agree, please explain to me what extra piece of information the brown eyed person in the second case has which means he can kill himself on day four. As far as I can see they are both in the situation that they can see three people with brown eyes, and no one has yet killed themselves. What is the extra piece of information that allows the brown eyed person in the second case to deduce that he has brown eyes?
You claim that if X = 4 and everyone has brown eyes then on day 4 they will all kill themselves. Suppose I am one of these islanders. I can see three people with brown eyes. On days one, two and three no one kills themselves. On day four I get up and kill myself because I know that I have brown eyes.
Fine, now let's consider the case where there are three people with brown eyes, and one person with green eyes:
As I think we've agreed above, the three people with brown eyes cannot infer that they have brown eyes (i.e. the X < 3 case). So they are not able to kill themselves.
But consider the green eyed person: he can see three people with brown eyes and no one kills themselves on days one, two or three.
He is in exactly the same situation at this point as the brown eyed person we considered in the four-brown-eyed-people case. So at this point, by your logic, he must know that he has brown eyes. Which is a contradiction.
I think you are wrong that induction is not involved in establishing eye colour. (unless you can convince me in the X = 4 case that is :) ).
This isn't a problem I'm unfamiliar with it, a colleague asked me it when I was being interviewed for my current job, and it gets rediscussed periodically. I really do think you're wrong I'm afraid.
Suppose X is one, then the brown eyed person appears to be stuck, all the blue eyed people are dead so he knows he doesn't have blue eyes, but he can't determine what colour his eyes are (are they brown?, are they green?).
If X is two then we're left with two people after all the blues are dead. Each one can see a brown eyed person, but again, this doesn't help them determine what colour their own eyes are. Again, why can they not be green?
The case for X>2 seems similar to the case for X=2, there's no magical point at which they can suddenly all say 'I don't have green eyes, I must have brown eyes'
With all respect, I think you are underestimating the problem. :)
In the case where they aren't told that only two colours exist, why would they kill themselves on day 900? Suppose instead that one of the brown eyed people had green eyes, I don't see how the brown eyed people or green eyed person could deduce the colour of their own eyes.
What would you suggest as a better alternative, outside of a purely functional approach? Just as an example, suppose that Java's LinkedList class didn't have a cached size and that instead it went and iterated its elements to calculate its size each time someone asked for it. I might write a wrapper around LinkedList with two private variables, the LinkedList and an int to cache its size in. Then I would update the int each time an operation was performed on my member list. If I can't make those two members private, how can I ensure that no one accidentally updates the list without updating the size, or vice-versa. It mightn't be an unreasonable mistake for someone to think calling mylist.size = 0 would empty the list. What is the 'safe' way of constructing this concept?