Buddahriffic

joined 2 years ago
MODERATOR OF
[–] Buddahriffic@lemmy.world 1 points 4 hours ago

That assumes SetTimeout() is O(1), but I suspect it is O(log(n)), making the algorithm O(n*log(n)), just like any other sort.

Did some looking into the specifics of SetTimeout() and while it uses a data structure with theoretical O(1) insertion, deletion, and execution (called a time wheel if you want to look it up), the actual complexity for deletion and execution is O(n/m) (if values get well distributed across the buckets, just O(n) if not) where m is the number of buckets used. For a lot of use cases you do get an effective O(1) for each step, but I don't believe using it as a sorting engine would get the best case performance out of it. So in terms of just n (considering m is usually constant), it'll be more like O(n²).

And it's actually a bit worse than that because the algorithm isn't just O(n/m) on execution. It needs to check each element of one bucket every tick of whatever bucket resolution it is using. So it's actually non-trivially dependent on the wait time of the longest value. It's still a constant multiplier so the big O notation still says O(n) (just for the check on all ticks), but it might be one of the most misleading O(n)'s I've ever seen.

Other timer implementations can do better for execute and delete, but then you lose that O(1) insertion and end up back at O(n*log(n)), but one that scales worse than tree sort because it is literally tree sort plus waiting for timeouts.

Oh and now, reading your comment again after reading about SetTimeout(), I see I misunderstood when I first read it and thought you meant it was almost as fast as bucket sort, but see now you meant it basically is bucket sort because of that SetTimeout() implementation. Bucket sort best case is O(n), worst case is O(n²), so I guess I can still do decent analysis lol.

[–] Buddahriffic@lemmy.world 1 points 15 hours ago

Cleaning can still help if it only slow charges (if you mean it used to be able to use high wattage ones).

Gunk prevents a strong connection, which can mess with the handshake. Charger will say, "yeah, I can fast charge, check out these amps!" but not all of it gets through and the case will decide the charger is a liar and just go with slow charging. Don't assume that something getting through at all means the connection is fine because USB has fallback options when conditions are sub-optimal.

[–] Buddahriffic@lemmy.world 2 points 15 hours ago

Soft is good because you want the cleaning tool to break before it can apply enough force to break or scratch the contact. Use a cleaning solution to soften the gunk instead. Doesn't have to be a part of a kit, just make sure it's safe for metals, like isopropyl alcohol.

[–] Buddahriffic@lemmy.world 6 points 15 hours ago (1 children)

I would not use metal simply because its hardness is going to be similar or higher than the hardness of the contacts themselves, which means there's a chance it could scratch or break the contact entirely.

[–] Buddahriffic@lemmy.world 3 points 15 hours ago (1 children)

The specs of saliva that go along with blowing corrode the contacts over time, so it is actually better to find an alternative with a soft brush and non/less-acidic cleaning solution.

Nintendo sold cartridge cleaning kits in the 90s (maybe even the 80s).

[–] Buddahriffic@lemmy.world 1 points 15 hours ago* (last edited 15 hours ago)

Lol you just saying that made me nervous. Using a staple would make it easy to accidentally break a contact off entirely, and I'm not sure if there are any consequences for shorting any of the USB pins to each other. Even a twist tie would be better, since it has another material to do the rubbing and the metal is less stiff than a staple.

Edit: there's another comment further down saying the risk of a short isn't an issue, but I'd still avoid using a staple just because of the hardness probably being higher than the contact.

[–] Buddahriffic@lemmy.world 5 points 15 hours ago

You don't want to be too rough on it. There's electrical contacts that can get blocked by dust, lint, and crap, so cleaning helps, but the contacts themselves aren't that thick, so you don't want to wear them down too much while cleaning. A cleaning solution helps loosen up everything with less force and a softer brush/pad is less likely to knock bits of contact off.

So just be careful because that brush might be like blowing in nintendo cartridges (clearing dust but leaving saliva specs that would wear the contacts), where it helps in the short term but makes things worse in the long term (resulting in more blowing and an acceleration of the process).

[–] Buddahriffic@lemmy.world 1 points 15 hours ago

Have you tried training them with a spray bottle?

[–] Buddahriffic@lemmy.world 4 points 15 hours ago

Any brush can be a toilet brush, you just need to stick it in the toilet. I have two, the second one looks like a dish brush but I got it because my main toilet brush doesn't reach everywhere at the bottom because it's too round/big.

[–] Buddahriffic@lemmy.world 2 points 15 hours ago

A little bit of mustard can enhance many sauces, too. Key words "a little bit". Like a bean pot recipe I base mine off of called for either 125 ml or 250 ml ketchup and 5 ml mustard. But if you forget that teaspoon of mustard, it doesn't taste nearly as good.

[–] Buddahriffic@lemmy.world 1 points 16 hours ago (1 children)

Plumbing issues? When I had one of those at my last place, it just had an attachment for the tap to get the water and another hose that drained into the sink. My current under the counter dishwasher is the exact same setup, it just taps into the inlet and drain under the sink instead of over it. The only physical change to the pluming was replacing the tap nozzle, which I put back without issue when I moved out (might have even given them a new screen when I did so).

[–] Buddahriffic@lemmy.world 1 points 16 hours ago

I bet early adopters will just end up with a robot that mostly just lives downstairs, occasionally making it to the top, but usually failing on at least one stair before it gets to the top and loudly clattering to the bottom before going to sleep for an exponentially increasing time (so that people can use the stairs between attempts).

view more: next ›