4 ms·
Disclaimer: We write distributed systems software. The question I always ask of programmers is this: You have n=10 computers in a cluster. Every one of them i
by Maro 15y ago
Disclaimer: We write distributed systems software.
The question I always ask of programmers is this:
You have n=10 computers in a cluster. Every one of them is connected to every other (but not to itself), using bidirectional TCP connections. How many TCP connections total in the cluster?
If they can't figure it out, I change it to n=4, then n=3 and ask them to work their way up from there.
- narkee 15y agoIs that supposed to be a trick question? I can't tell if the answer is n(n-1)/2 or just n(n-1), because I'm unsure whether you would be looking to count a "bidirectional TCP connection" as 1 or 2 TCP connections...
- Maro 15y agoWhen I give this question I always make sure it's clear that I mean the "/2" case by saying something like "so there's only connection between each pair of computers" or "so you only count one connection between each pair computers". Anyways, the point is to weed out people who say nonsense like 10^9 and 9^10 and 10! and whatever else pops into their head. In cases when people give these incorrect answers, it's always clear that they're just guessing, and when I tell them it's wrong they stress out and that's that. They refuse to even answer the n=3 case, because they've already given up. The reason we found this a good filter is because people who are unwilling to think a little to give the right answer, are usually unimpressive in other parts of the interview, too. Ie. they give stock answers, and if we ask more or would like to drill down, they give up. That's our limited experience.
- newman314 15y agoYeah, I wasn't sure the way the question was posed either if it was n(n-1)/2 or n(n-1). The bidirectional piece needs to be clarified in the way the question is posed.
- run4yourlives 15y agoPerhaps it is how you are communicating that... I have no idea what you are looking for. Are you really asking the answer to 9 x 9? Am I missing something?
- Confusion 15y agoIt's new years eve and the bell chimes. You are with 9 other people. How often do you toast, if everyone toasts with everyone else once?
- opendomain 15y agofor n=2, are you counting 1 total connection between 2 computers, or EACH conection from a server to another meaning 2 total connections? Assuming each connection, is it simply n! or 3628800 for n=10, or is my math wrong?
- deleted 15y ago[deleted]
- Dove 15y agoI also thought it would be factorial at first, but a moment's thought proves that wrong. Imagine adding a new computer to an already connected cluster. How many new connections?
- newman314 15y agoIt's not factorial. SPOILER (do not click): http://johnmcmanus7742.wordpress.com/2009/01/22/calculate-full-mesh/ http://johnmcmanus7742.wordpress.com/2009/01/22/calculate-fu...
- deleted 15y ago[deleted]