• lugal@sopuli.xyz
    link
    fedilink
    arrow-up
    0
    ·
    4 months ago

    According to that logic, everything is O(1) because at some point you go out of memory or your computer crashes.

    “How fast is your sorting algorithm?” – “It can’t sort all the atoms in the universe so O(1).”

    That’s not how O notation works. It is about asymptomatics. It is about “What if it doesn’t crash”, “what if infinity”.

    So, again, what exactly is your question if your answer is O(1)?

    • Kogasa@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      4 months ago

      O notation has a precise definition. A function f : N -> R+ is said to be O(g(x)) (for some g : N -> R) if there exists a constant c so that f(n) <= cg(n) for all sufficiently large n. If f is bounded, then f is O(1).

    • Sotuanduso@lemm.ee
      link
      fedilink
      English
      arrow-up
      0
      ·
      4 months ago

      Yeah, you’re right, I’m not being rigorous here. I’m just co-opting big O notation somewhat inaccurately to express that this isn’t going to get as big as it seems because the number of upvotes isn’t going to increase all that much.