• @[email protected]
      link
      fedilink
      152 months ago

      It doesn’t, the array is still in the same order it started in, it’s members are just printed to the console in numerical order.

      It just prints the number 1 after 1 ms, 2 after 2 ms, 3 after 3 ms etc.

      • @Randelung
        link
        72 months ago

        Instead of print you could add them to a second array, though. Even clear the original first for “in place” sorting; never mind the memory allocation for the lambdas.

      • @Maalus
        link
        22 months ago

        Also since you aren’t guaranteed that there is a “happens before” relationship, it’s a wrong implementation that returns unsorted arrays in text too.