Europe Pub
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
☆ Yσɠƚԋσʂ ☆@lemmy.ml to Programmer Humor@lemmy.mlEnglish · il y a 9 mois

timeoutSort

message-square
9
link
fedilink
  • cross-posted to:
  • programmer_humor@programming.dev
102

timeoutSort

☆ Yσɠƚԋσʂ ☆@lemmy.ml to Programmer Humor@lemmy.mlEnglish · il y a 9 mois
message-square
9
link
fedilink
  • cross-posted to:
  • programmer_humor@programming.dev
alert-triangle
You must log in or # to comment.
  • owenfromcanada@lemmy.ca
    link
    fedilink
    arrow-up
    18
    ·
    il y a 9 mois

    How does a programming joke cause me physical pain?

  • LadyMeow@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    9
    ·
    il y a 9 mois

    I mean, it’s basically O(1), right? :p

    • Ephera@lemmy.ml
      link
      fedilink
      English
      arrow-up
      14
      ·
      il y a 9 mois

      I mean, it does scale with the size of the input. Just not with the count of inputs, but rather the size of each input element.

      • jimmux@programming.dev
        link
        fedilink
        arrow-up
        5
        ·
        il y a 9 mois

        Or just the size of the largest input?

        • Ephera@lemmy.ml
          link
          fedilink
          English
          arrow-up
          2
          ·
          il y a 9 mois

          Oh yeah, I do think setTimeout executes in parallel, so only the largest element determines the execution time. It was difficult enough to make that sentence make sense, so I didn’t want to cram that detail in as well. 🙃

    • marduk@lemmy.sdf.org
      link
      fedilink
      arrow-up
      4
      ·
      il y a 9 mois

      O(shit)

  • limer@lemmy.ml
    link
    fedilink
    arrow-up
    7
    ·
    il y a 9 mois

    If it is stupid and it works it’s not stupid.

    I’m going to use it

  • Cat_Daddy [any, any]@hexbear.net
    link
    fedilink
    English
    arrow-up
    5
    ·
    il y a 9 mois

    snortle

  • Vinapocalypse@lemmy.ml
    link
    fedilink
    arrow-up
    4
    ·
    edit-2
    il y a 9 mois

    PR:

    -  setTimeout(() => console.log(item), item)
    +  setTimeout(() => console.log(item), Math.log(item))
    

    Comment: This will speed up sort time greatly. However, sort order may become erratic for longer lists, and lists with numbers less than 1

Programmer Humor@lemmy.ml

programmerhumor@lemmy.ml

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmerhumor@lemmy.ml

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 180 users / day
  • 284 users / week
  • 1.66K users / month
  • 4.87K users / 6 months
  • 25 local subscribers
  • 43.1K subscribers
  • 934 Posts
  • 5.47K Comments
  • Modlog
  • mods:
  • cat_programmer@lemmy.ml
  • BE: 0.19.18
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org