Post

JavaScript Daily
JavaScript Daily@JavaScriptDaily·
Presenting the "sleep sort", our favorite O(wtf) sorting algorithm. (C'mon, it's the weekend..) 😂
JavaScript Daily tweet media
English
21
892
1.4K
0
Михаил Коптелов
Михаил Коптелов@MikhailKoptelov·
@JavaScriptDaily Not deterministic. Anything <10ms can return in order of calling. Can fix it up with setTimeout(..., num * 1000); Time complx is the same!
English
1
0
18
0
ohcibi
ohcibi@ohcibi·
@JavaScriptDaily The complexity should be O(n) as sleeping does increase it. Pretty strong stuff!!
English
0
0
0
0
@·
@JavaScriptDaily Check this out . function sorting(arr) { const sortArr = []; arr.forEach((a) => (sortArr[a] = a)); return sortArr.filter((s) => s != null); }
English
0
0
0
0
Mark Kawakami
Mark Kawakami@skippykawakami·
@JavaScriptDaily This is actually kinda genius. I'm giving respect for originality and comedic timing.
English
1
0
22
0
@·
@JavaScriptDaily @jonikorpi With a little modification that could work really well as a quick way of scheduling the Web Audio API just ahead of time.
English
0
0
3
0
Jon Donkin
Jon Donkin@Jondonkin·
@JavaScriptDaily I tried in C#, works in .net framework but not in .net, they must have changed something about Parallel.ForEach.
English
0
0
0
2
Bagikan