Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
osmarks8668yIt's easy to optimize if performance becomes problematic! Just add a / 100 somewhere.
-
@rusty-hacker just normalize the numbers to be positive :) then undo it afterwards
-
@tylerhartwig not possible since you don't know in advanced what the lowest negative number will be.
-
@thejohnhoffer True.... You could do it for integers by switching signed to unsigned and back again, but you run into an issue on floats :/
-
eddiesun18yLike counting sort, linear running time, with respect to number of bits in the largest integer in the array.
-
lol that's hilarious! however instead of logging the output, why not use promises?
-
tmux20118yWould that work on a really long array of numbers?
Something like [1,3,...,2,....]
If the array is long enough, won't the 3 timeout fire before the timeout of 2 is even created?
Best sorting algorithm ever.
Sleep sort.
š
undefined