There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

0x0 , in How I date

It’s funny because it’s true.

crossmr , in I Will Fucking Piledrive You If You Mention AI Again

are there a lot of new things to say about this after it was posted 4 days ago? https://kbin.run/m/[email protected]/t/503264/I-Will-Fucking-Piledrive-You-if-You-mention-AI-Again#comments

sirico , in How I date
@sirico@feddit.uk avatar

Where’s socks?

KomfortablesKissen ,
Mikina , (edited ) in Not everything can be done in constant time, that's O(k)

It has been a while since I have to deal with problem complexities in college, is there even class of problems that would require something like this, or is there a proven upper limit/can this be simplified? I don’t think I’ve ever seen O(n!^k) class of problems.

Hmm, iirc non-deterministic turing machines should be able to solve most problems, but I’m not sure we ever talked about problems that are not NP. Are there such problems? And how is the problem class even called?

Oh, right, you also have EXP and NEXP. But that’s the highest class on wiki, and I can’t find if it’s proven that it’s enough for all problems. Is there a FACT and NFACT class?

pantyhosewimp , in Not everything can be done in constant time, that's O(k)

After all these years I still don’t know how to look at what I’ve coded and tell you a big O math formula for its efficiency.

I don’t even know the words. Like is quadratic worse than polynomial? Or are those two words not legit?

However, I have seen janky performance, used performance tools to examine the problem and then improved things.

I would like to be able to glance at some code and truthfully and accurately and correctly say, “Oh that’s in factorial time,” but it’s just never come up in the blue-collar coding I do, and I can’t afford to spend time on stuff that isn’t necessary.

xthexder ,
@xthexder@l.sw0.com avatar

A quadratic function is just one possible polynomial. They’re also not really related to big-O complexity, where you mostly just care about what the highest exponent is: O(n^2) vs O(n^3).

For most short programs it’s fairly easy to determine the complexity. Just count how many nested loops you have. If there’s no loops, it’s probably O(1) unless you’re calling other functions that hide the complexity.

If there’s one loop that runs N times, it’s O(n), and if you have a nested loop, it’s likely O(n^2).

You throw out any constant-time portion, so your function’s actual runtime might be the polynomial: 5n^3 + 2n^2 + 6n + 20. But the big-O notation would simply be O(n^3) in that case.

I’m simplifying a little, but that’s the overview. I think a lot of people just memorize that certain algorithms have a certain complexity, like binary search being O(log n) for example.

Alexstarfire ,

Spot on. Good explanation.

magic_lobster_party ,

Time complexity is mostly useful in theoretical computer science. In practice it’s rare you need to accurately estimate time complexity. If it’s fast, then it’s fast. If it’s slow, then you should try to make it faster. Often it’s not about optimizing the time complexity to make the code faster.

All you really need to know is:

  • Array lookup: O(1)
  • Single for loop: O(n)
  • Double nested for loop: O(n^2)
  • Triple nested for loop: O(n^3)
  • Sorting: O(n log n)

There are exceptions, so don’t always follow these rules blindly.

It’s hard to just “accidentally” write code that’s O(n!), so don’t worry about it too much.

uis ,

lim n->inf t(n) <= O*c, where O is what is inside of big O and c is positive constant.

uis ,

Basically you can say that time it takes never goes above grapf of some function scaled by constant.

Fun side effect of this is that you can call your O(1) algorithm is O(n!) algorithm and be technically correct.

Mikina ,

Here is a picture, that may help a little bit. The n is input size, and f(n) is how long does the algorithm runs (i.e how many instructions) it takes to calculate it for input for size n, i.e for finding smallest element in an array, n would be the number of elements in the array. g(n) is then the function you have in O, so if you have O(n^2) algorithm, the g(n) = n^2

Basically, you are looking for how quickly it grows for extreme values of N, while also disregarding constants. The graph representation probably isn’t too useful for figuring the O value, but it can help a little bit with understanding it - you want to find a O function where from one point onward (n0), the f(n) is under the O function all the way into infinity.

https://programming.dev/pictrs/image/b9a179bb-6a6f-47d1-8c5b-8286c1679d2a.png

Kolanaki , in Not everything can be done in constant time, that's O(k)
@Kolanaki@yiffit.net avatar

Wait… How can time ever not be constant? Can we stop time?! 😮

Mikina , in Not everything can be done in constant time, that's O(k)

For me, my common result would be something like O(shit).

IndiBrony , in I'll have you know, my fork of a github repo has 3 stars 😎
@IndiBrony@lemmy.world avatar

I have 69 followers on YouTube. Where does that put me?

pineapplelover ,

You’re pretty much famous bro. Can I get your autograph?

IndiBrony ,
@IndiBrony@lemmy.world avatar
passepartout OP ,
@passepartout@feddit.org avatar

On top of another person, or below if that’s your style. In any way, your head must face their genitals and other way round. Glad I could help!

Ziglin , (edited ) in I'll have you know, my fork of a github repo has 3 stars 😎

Me and my D&D group 👀

frightful_hobgoblin , in I Will Fucking Piledrive You If You Mention AI Again

cringe

Socsa , in How I date

*Haskell

davidagain ,

But I’m scared of Monad transformers and lenses. Can’t I just use elm? Elm is so perfect, so pure, so very very pure. And so pretty. And so robust. And so instantaneous to compile, and with such helpful error messages. Come to me, haskell programmer, you’ll never want to leave. Never leave… Always elm… Lovely lovely elm…

bruhduh , in How I date
@bruhduh@lemmy.world avatar

FORTRAN

taanegl , in How I date

Primeagen?

Anticorp , in How I date

*cracks knuckles

My kind of evening…

Thcdenton , in How I date

My shoes were already off.

Iheartcheese ,
@Iheartcheese@lemmy.world avatar

( ͡° ͜ʖ ͡°)

Knoxvomica ,

LOOK AT MY CROOKED TOES

Iheartcheese ,
@Iheartcheese@lemmy.world avatar

Oh I’m looking

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines