• BatmanAoD
    link
    fedilink
    arrow-up
    88
    ·
    7 hours ago

    Reminds me of quantum-bogosort: randomize the list; check if it is sorted. If it is, you’re done; otherwise, destroy this universe.

    • NaN@lemmy.world
      link
      fedilink
      arrow-up
      11
      ·
      3 hours ago

      Instead of destroying the universe, can we destroy prior, failed shuffle/check iterations to retain o(1)? Then we wouldn’t have to reload all of creation into RAM.

      • BatmanAoD
        link
        fedilink
        arrow-up
        3
        ·
        1 hour ago

        Delete prior iterations of the loop in the same timeline? I’m not sure there’s anything in quantum mechanics to permit that…

    • xmunk@sh.itjust.works
      link
      fedilink
      arrow-up
      60
      ·
      7 hours ago

      Guaranteed to sort the list in nearly instantaneous time and with absolutely no downsides that are capable of objecting.

      • frezik@midwest.social
        link
        fedilink
        arrow-up
        29
        ·
        6 hours ago

        You still have to check that it’s sorted, which is O(n).

        We’ll also assume that destroying the universe takes constant time.

        • Benjaben@lemmy.world
          link
          fedilink
          arrow-up
          3
          ·
          1 hour ago

          We’ll also assume that destroying the universe takes constant time.

          Well yeah just delete the pointer to it!

        • BatmanAoD
          link
          fedilink
          arrow-up
          19
          ·
          5 hours ago

          In the universe where the list is sorted, it doesn’t actually matter how long the destruction takes!

      • vithigar@lemmy.ca
        link
        fedilink
        arrow-up
        11
        ·
        6 hours ago

        Except you missed a bug in the “check if it’s sorted” code and it ends up destroying every universe.

      • jcg@halubilo.social
        link
        fedilink
        arrow-up
        20
        ·
        edit-2
        7 hours ago

        is-sorted and a handful of about 300 other npm packages. Cloning the repo and installing takes about 16 hours but after that you’re pretty much good for the rest of eternity

    • frezik@midwest.social
      link
      fedilink
      arrow-up
      2
      ·
      6 hours ago

      Since randomizing the list increases entropy, it could theoretically make your cpu cooler just before it destroys the universe.