this post was submitted on 02 Dec 2024
1457 points (99.3% liked)

Memes

8429 readers
1130 users here now

Post memes here.

A meme is an idea, behavior, or style that spreads by means of imitation from person to person within a culture and often carries symbolic meaning representing a particular phenomenon or theme.

An Internet meme or meme, is a cultural item that is spread via the Internet, often through social media platforms. The name is by the concept of memes proposed by Richard Dawkins in 1972. Internet memes can take various forms, such as images, videos, GIFs, and various other viral sensations.


Laittakaa meemejä tänne.

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 51 points 2 days ago* (last edited 2 days ago) (5 children)

My dad once told me that he had to find the circuit breaker that corresponded to a particular wire and because we have around 60 circuit breakers in our house, he had to flick one off, run down and check the wire, run back up, flick the next circuit breaker off, and do that quite a lot of times.

In that moment, I got to explain binary search to him and he was genuinely interested. 🙃

[–] [email protected] 30 points 1 day ago (1 children)

I think the old school method was to plug in a stereo and turn the volume up. When you couldn't hear it then you got the right breaker.

[–] [email protected] 11 points 1 day ago

I hook a cheap webcam up to a USB battery pack and load it up on my phone. Then I plug in a light and point the camera at that. It makes it a single trip and doesn't bother the neighbors.

[–] [email protected] 11 points 2 days ago (3 children)

My friend has some upcoming electrical work in his house, can you explain how to use binary search in this instance so I can tell him?

[–] [email protected] 28 points 2 days ago

Turn off half the breakers. See if you still have power where you need to go. That will tell you which half it's on. Turn off half of those breakers, repeat.

[–] [email protected] 3 points 1 day ago* (last edited 1 day ago)

Turn off half the breakers. Now you know which half the outlet is on, based on whether or not it has power. Repeat.

For instance, let’s say you have 100 breakers. You turn off the first 50. Your target outlet still has power. So now you have divided the potential number of breakers by half, and you know the breaker is somewhere in 51-100.

So you cut that in half, and turn off 51-75. Your outlet is now dead, so you know it’s somewhere in the 51-75 range that you just turned off; if it were still on, it would be somewhere between 76-100.

So now you reset 51-63, while leaving 64-75 off. It is still dead, so you know it is somewhere between 64-75.

Maybe now you turn on all of the odd breakers, leaving the evens off. It is still dead, so you know it must be 64, 66, 68, 70, 72, or 74. Reset the first three. Your outlet has power now, so it must be one of the first three.

Flip 64 and 66 off. If you get lucky, your outlet still has power and you know it is 68. But you get unlucky, and it is dead. So now you know it must be either 64 or 66.

Flip 64 back on. If it has power, you know it’s 64. If it doesn’t, you know it’s 66.

We just eliminated 99 breakers and found the correct one using only 7 tests. Because each test eliminated half of the potential values, it whittles things down very quickly. We went from 1-100, to 51-100, to 51-75, to 64-75, to the evens between 64-74, to only 64/66/68, to 64/66, and finally landed on 66 as the correct breaker. If we had gotten lucky earlier, we could have done it in 6 instead. If you had simply started with breaker 1 and worked subsequently, it would have taken 66 trips to the breaker box to figure out.

Where binary search really excels is with large data sets. Even if it had been 1000 breakers instead of 100, it still would have only taken an extra three or four searches (1-1000 > 1-500 > 1-250 > 1-125 > 1-75… etc…) to narrow it down.

[–] [email protected] 11 points 2 days ago (2 children)

Oh, well, you switch off half the fuses, then you go check the wire.
Let's say the wire still has power on it, so now you know that none of the fuses in that half affected it (which you can turn back on now).

Then you do the same thing again with the other half of the fuses, i.e. you switch off half of the fuses in that half and go check the wire.
Now, let's say the wire is dead, so now you know that the fuse you want is in this quarter.

So, then you flick off half of the fuses in that quarter and check the wire again, and so on.

With every step, you eliminate half of the remaining fuses, so for 60 fuses, you need at most 6 steps (which is the logarithm for base 2 of 60).

[–] [email protected] 7 points 2 days ago (2 children)

Once you figure out which one it is, label it! I labeled all the breakers in my panel when I moved in to my house, as half of the existing labels were wrong (no idea why).

[–] [email protected] 7 points 2 days ago (1 children)

That's the case with virtually every breaker box.

[–] [email protected] 6 points 1 day ago (2 children)

Why are so many mislabeled though? It's not like the loads are being changed every day. I had two breakers labeled "dishwasher" and neither of them were the dishwasher!

[–] [email protected] 3 points 1 day ago

I had two breakers labeled “dishwasher”

Electrical work is one of those things that's not difficult to do as long as you don't mind it being some level of wrong but relatively hard to do 100% to code right without training. With most of the wrong ways, the project still works, but it's dangerous and/or hard to maintain. Professional work is expensive, so you end up with a LOT of handyman work that's poorly labeled, poorly run, poorly designed or some combination of the three.

My best guess would be that at some point, running the dishwasher tripped the breaker. They had space so they added a breaker below it and moved the line to the new breaker. Then it still tripped, so they moved the line at the dishwasher circuit that was already close by.

Either the original line has a fault in it (old aluminum lines can have junction issues over time) or the dishwasher had a short in it, and they either replaced the dishwasher, or the new line they chose didn't fail.

[–] [email protected] 1 points 1 day ago

What Rumba said. Why full ass a job when half is plenty.

[–] [email protected] 3 points 1 day ago

I keep a spreadsheet with every outlet/light in every room on it and their corresponding breakers. Much easier since breakers often span multiple rooms, sometimes only powering one or two fixtures in each.

[–] [email protected] 4 points 1 day ago (1 children)

Ah, obvious now, thank you. For some reason ~~my~~ his brain couldn't get to actually turning off half the breakers in one go

[–] [email protected] 2 points 1 day ago

Binary search requires splitting the search space into two halves, then asking “is it in that half?”

Normally the “is it in that half?” check involves a numerical comparison: test value versus target value. “higher or lower” here gets you to “is it in that half?”

So finding the midpoint seems like a core part of the process, but really that’s just a shortcut in the case of comparable values, that helps you split into two and check membership.

I admit I couldn’t think of that either: just alter half the items and check for effect.

[–] [email protected] 6 points 2 days ago (1 children)

If he can flick it off then it's a circuit breaker, not a fuse. Fuses have to be pulled, and it's a real PITA.

[–] [email protected] 3 points 2 days ago (1 children)

Thanks, I changed it. I wasn't sure, what the correct English word is...

[–] [email protected] 8 points 2 days ago

I would have never guessed that you're not a native English speaker from your writing. Neat!

A fuse and a circuit breaker perform the same function, but a fuse blows out and has to be replaced, whereas a circuit breaker can just be flipped back on. Fuses haven't been used in household wiring for a long time now, but they're still used in cars, and for portable things like Christmas lights.

[–] [email protected] 2 points 2 days ago (2 children)

Binary search only works if the fuses were correctly sorted in the same order as the houses though.

[–] [email protected] 22 points 2 days ago* (last edited 2 days ago) (1 children)

I don't think that's true, it's more of a set problem. If you pull half the fuses, and the thing is still on, then you've ruled out that half. Then you pull half the remaining fuses, and if it turns off it was one of the new half you pulled. Then you put another half back in, ect .

[–] [email protected] 6 points 1 day ago

Ah, I didn't think of it that way. That indeed would work.

[–] [email protected] 4 points 2 days ago (1 children)

You know, after posting that comment, I really doubted myself, if it really is binary search, because Wikipedia also tells me it needs to be a sorted array.

But yeah, I think that's only relevant, if your method of checking whether it's in one half or the other uses > and <. As far as I can tell, so long as you can individually identify the fuses, a.k.a. they're countable, then you can apply binary search.

[–] [email protected] 3 points 1 day ago

If when you divide your set in two, you can reliably tell which of the two subsets definitely has what you're looking for, then it's binary search.