• @[email protected]
    link
    fedilink
    1513 days 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
      713 days 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
      213 days 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.