« first day (5138 days earlier)    last day (1 day later) » 

14:56
O(1) sorting algorithm (pseudocode):
MAIN(LIST):
For item in list: summon coroutine(item)
COROUTINE(ITEM):
WAIT arctan(item) seconds
add item to global list
(Assuming infinitely many cores on computer)
Refined sleepsort
Infinite cores are not really going to help you though, but fun in theory
15:13
@TheEmptyStringPhotographer brb waiting -90° seconds
15:47
You could add 90 to make it work for negative numbers
16:01
Yeah of course lol
16:45
@noodleperson Output is in radians
att
att
17:13
° is a constant =pi/180 :p
@TheEmptyStringPhotographer Sure, you still have to add though
 
1 hour later…
18:34
@noodleperson Amendment: the line now says WAIT arctan(item) + 2*pi seconds
@TheEmptyStringPhotographer Correction: I meant arctan(item) + pi/2
19:35
:3
19:50
Python O(1) (or is it Omega(1)) sorting algorithm:
from multiprocessing import Pool
import time
import math

def sleep_function(x):
    return math.atan(x)+math.pi/2

def worker(x):
    time.sleep(sleep_function(x))
    print(x)

def tantime_sort(l):
    with Pool(len(l)) as p:
        p.map(worker, l)

TEST_CASE = [3, 21, 1000, 17, 69, -2, 1.0, 10000, 0.1]

tantime_sort(TEST_CASE)
(Variation of sleepsort)
(It's called Tantime Sort, and I made it)

« first day (5138 days earlier)    last day (1 day later) »