Skip to content

Replacing memory in a desktop – Binary algorithm?

Cut long story short … computer started to act weird, narrowed down to memory problem. Got 4 slots 1 GB each, and 1 of them is faulty. Want to find out which one, and get rid of it.
Problem is, how quickly can I find it?

Replacing memory using Binary algorithm

I have to shutdown the computer, then remove one memory, start it up, if no problems – hurray! I found it out in first shot (lucky?). If not, I remove next one, still no good. Remove third one, nope. Remove fourth one, YES!

Took 4 times to restart till I narrowed it to last one.

Interesting.

Can I do it quicker, not 4 times, without relying on luck, but guaranteed!?!

Tried below

  • Took out all, put one by one back … not good – still minimum 3 restarts till I can say last one remaning in my hand is the bad one, because the 3 that went in don’t give the problem anymore.
  • Pick up one by one … oops we already tried that :-S
  • Pick randomly? – Not allowed to be lucky, no.
  • Put 2, keep 2. Hmmm … this seems good. First restart, all good. That means one of those in my hand is faulty. Remove good ones, put those in my hand, baam! Second restart, remove 1, keep 1 back, third restart – either one in my hand is faulty, or the one plugged in. – 3 restarts … wait
  • What if I don’t put the two in my hand together? First restart says the 2 plugged in are good. So, to know which one in my hand is faulty, I put only _one_ back in. Second restart, if good, the one in my hand is faulty!

Hurray, I can do it just in two steps. Put 2 in, keep 2. Restart says OK. Means bad 1 is in other 2. Put 1, restart. OK. 1 I didn’t put back in was faulty!

4 memory slots, 1 faulty. 2 restarts to find which one. I know Binary algorithm in real life!

Leave a Reply

Your email address will not be published. Required fields are marked *

10 − one =