• Lysergid@lemmy.ml
    Aquileo | link
    Aquileo | fedilink
    Aquileo | arrow-up
    6
    Aquileo | arrow-down
    1
    ·
    2 months ago

    I mean, if structure is O(1) for low N, it’s still O(1) for high N. If O “changes” from 1 to N with size then it’s never been 1. All I’m saying

    “if it’s big”

    is not how you identify correct O

    • hirihit640@sh.itjust.works
      Aquileo | link
      Aquileo | fedilink
      English
      Aquileo | arrow-up
      3
      ·
      2 months ago

      I only put “if it’s big” to help readers imagine a large pile and how it would become more inconvenient the larger the pile. Language is not as precise as math or programming. If you’d like you can imagine the sentence as saying something like “imagine a big pile. It’s definitely not O(1)”

    • Lojcs@piefed.social
      Aquileo | link
      Aquileo | fedilink
      English
      Aquileo | arrow-up
      2
      ·
      Aquileo | edit-2
      2 months ago

      It is quite reasonable to limit the average case O to the most common inputs with the caveat that it can be worse otherwise. It’s not like every arithmetic operation is counted as O(n) in Python for example as you aren’t expected to use numbers larger than 2^32 often