Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Genius sorting algorithm: Sleep sort

Name: Anonymous 2011-01-20 12:22

Man, am I a genius. Check out this sorting algorithm I just invented.


#!/bin/bash
function f() {
    sleep "$1"
    echo "$1"
}
while [ -n "$1" ]
do
    f "$1" &
    shift
done
wait


example usage:
./sleepsort.bash 5 3 6 3 6 3 1 4 7

Name: AnonyCat 2011-06-16 9:23

Lazy short

#The most lazy way to short
.
.
.
echo "just watching this blog & copy"

Name: Anonymous 2011-06-16 9:26

>>237
Then you don't belong here ``faggot''. Please leave.

Name: Anonymous 2011-06-16 9:28

>>242
No, Randall, you're the outsiders.

Name: Anonymous 2011-06-16 9:39


              ∧_∧
              (    )
────-㎜────/   \────────
       \\   //\   \
..        \\//   \   \
          \/      ) ∴)ヾ)
                  /  / ⌒ヽ
                  /  /| |   |←>>Reddit
                  / / .∪ / ノ
                 / / . | ||
                ( ´|   ∪∪
                 | |   | |
                 | |   | |
                 | |   | |
                 | |   | |
               (´ ノ  (´ ノ

Name: Anonymous 2011-06-16 9:42



             /◎)))
            / / :
            / /  :
           / /   :
     /prog/   / /     :,
          / /      :,
     人   / /       :,
    (__)  / /         :,
    .(__) / /          :,
   .(,,・∀・)  /          、 .人
   |/ つ¶__/    ヽヽ     (__)  ガッ! >>Reddit
   L ヽ /. |     ヽ ニ三 .(__) ..人∧__,∧∩
   _∪ |___|           .(___)<  >`Д´)./
   [____]_                .V/    /
 /______ヽ_ヽ                /  / ./
 |______|_|              (__,)_)
/◎。◎。◎。◎ヽ= / ̄/
ヽ_◎_◎_◎_◎ノ=ノヽニヽ

Name: Anonymous 2011-06-16 9:53

>>236
Sleep Sort is an integer sorting algorithm I found on the Internet.
He didn't even give OP credit. But that's probably for the best seeing how dumb the reddit posters in this thread are.

Name: Bill 2011-06-16 9:59

I hate to rain on every ones parade, but this algorithm is only low order if you ignore kernel scheduling efficiencies.  As you add more processes the kernel will have to do more work to correctly order the invocations.  I do not know what the typical scheduler efficiency is, but I would not be surprised if it is O(n^2) or worse.

Name: Anonymous 2011-06-16 9:59

>>247
SCHEDULE MY ANUS

Name: Anonymous 2011-06-16 10:04

>>247
Thank you for pointing out what >>133­-kun explained a month ago, Bill.

Name: Anonymous 2011-06-16 10:15

Can we please forget about this shit and leave the sepplessort to the reddit nigger fags?

Name: Anonymous 2011-06-16 10:23

>>250
What about intellectual property? We should sue them.

Name: Anonymous 2011-06-16 10:57

>>251
/prog/ is gonna be richer than any nigger eveer imagined possible

Name: Anonymous 2011-06-16 11:05

I still refuse to believe that any reddit users have actually poasted here.

Name: You 2011-06-16 11:11

<h1>LOL LOVE IT</h1>

Name: Anonymous 2011-06-16 11:13

>>253
poasted
G! T! F! O!

Name: Anonymous 2011-06-16 11:22

>>253 Hi, I'm from reddit! I hear this site is a great place to get my programming questions answered?

Name: Anonymous 2011-06-16 11:23

^fail

Name: RedCream 2011-06-16 11:24

>>255
Do not defy the Cream lest you end up on the receiving end of the goatfinger.

Name: Anonymous 2011-06-16 11:25

It's not a sorting algorithm until this guy's done it.

http://www.youtube.com/watch?v=ROalU379l3U&feature=related

Name: Anonymous 2011-06-16 12:32

pretty fucking cool

Name: Anonymous 2011-06-16 12:35

Anyways, >>260, please listen to me. That it's really related to this thread.
I went to Yoshinoya a while ago; you know, Yoshinoya?
Well anyways there was an insane number of people there, and I couldn't get in.
Then, I looked at the banner hanging from the ceiling, and it had "150 yen off" written on it.
Oh, the stupidity. Those idiots.
You, don't come to Yoshinoya just because it's 150 yen off, fool.
It's only 150 yen, 1-5-0 YEN for crying out loud.
There're even entire families here. Family of 4, all out for some Yoshinoya, huh? How fucking nice.
"Alright, daddy's gonna order the extra-large." God I can't bear to watch.
You people, I'll give you 150 yen if you get out of those seats.
Yosinoya should be a bloody place.
That tense atmosphere, where two guys on opposite sides of the U-shaped table can start a fight at any time,
the stab-or-be-stabbed mentality, that's what's great about this place.
Women and children should screw off and stay home.
Anyways, I was about to start eating, and then the bastard beside me goes "extra-large, with extra sauce."
Who in the world orders extra sauce nowadays, you moron?
I want to ask him, "do you REALLY want to eat it with extra sauce?"
I want to interrogate him. I want to interrogate him for roughly an hour.
Are you sure you don't just want to try saying "extra sauce"?
Coming from a Yoshinoya veteran such as myself, the latest trend among us vets is this, extra green onion.
That's right, extra green onion. This is the vet's way of eating.
Extra green onion means more green onion than sauce. But on the other hand the price is a tad higher. This is the key.
And then, it's delicious. This is unbeatable.
However, if you order this then there is danger that you'll be marked by the employees from next time on; it's a double-edged sword.
I can't recommend it to amateurs.
What this all really means, though, is that you, >>260-kun, should just stick with today's special.

Name: James Herring 2011-06-16 12:39

Here's my more efficient rendition of the OP's code: http://bit.ly/97Q3tx

Name: Anonymous 2011-06-16 13:36



Why would you want to wait for 2,000 milliseconds just to sort this array: [2000 1]

Name: Anonymous 2011-06-16 14:01

>>263
THE SAME OBSERVATION WAS MADE IN THE FIRST REPLY, OVER 5 MONTHS AGO. PLEASE GO BACK TO REDDIT!

Name: Anonymous 2011-06-16 14:04

hbk

Name: Anonymous 2011-06-16 14:09

>>264
* HAS BEEN MADE

Name: Anonymous 2011-06-16 14:14

>>262
Stop - there might be a problem with the requested link

Name: Oliv 2011-06-16 14:20

>>4
In terms of operations, the complexity is always O(n), even in average and worse cases. That's something no other algorithm can do according to http://en.wikipedia.org/wiki/Sorting_algorithm#Comparison_of_algorithms

Name: Anonymous 2011-06-16 14:31

Thanks, Oliv.

Name: Anonymous 2011-06-16 14:45

>>267
troll

Name: Anonymous 2011-06-16 15:22

>>268
O(myanus)

Name: Anonymous 2011-06-16 15:29

Java-Fag posts java-impl:





import  java.util.ArrayList;

public class Main extends Thread{
    Long toSleep;
    ArrayList<Long> solution;
   
    public static void main(String[] args){
        ArrayList<Long> solution = new ArrayList<Long>();
        ArrayList<Thread> solverThreads = new ArrayList<Thread>();
       
        for(String val: args){
            Long valNum = Long.parseLong(val);
            Thread solverThread = new Main(valNum, solution);
           
            solverThread.start();
            solverThreads.add(solverThread);
        }
       
        for(Thread solverThread: solverThreads){
            try {
                solverThread.join();
            } catch (InterruptedException e) {
                // gtfo
            }
        }
       
        System.out.println(solution.toString());
    }
   
    public Main(Long toSleep, ArrayList<Long> solution){
        this.toSleep = toSleep;
        this.solution = solution;
    }
   
    public void run(){
        try {
            Thread.sleep(toSleep*1000);
        } catch (InterruptedException e) {
            // gtfo
        }
       
        solution.add(toSleep);
    }
}

Name: Anonymous 2011-06-16 16:00

>>262
i had to click though two consecutive malware warnings to se a parrot on a dick. the attempts to harm my pc are cute, but futile. (java? srsly?)

Name: Anonymous 2011-06-16 16:31

>>273
back to reddit please

Name: Anonymous 2011-06-16 17:14

where the fuck is all the python code?

all of these other shitty languages are getting attention and the only good one isn't

Name: Anonymous 2011-06-16 17:54

>>275
See >>274

Name: yiihsia 2011-06-17 1:14

haha,java:


public class SleepSort {
    public static void main(String[] args) {
        int[] ints = {1,4,7,3,8,9,2,6,5};
        SortThread[] sortThreads = new SortThread[ints.length];
        for (int i = 0; i < sortThreads.length; i++) {
            sortThreads[i] = new SortThread(ints[i]);
        }
        for (int i = 0; i < sortThreads.length; i++) {
            sortThreads[i].start();
        }
    }
}
class SortThread extends Thread{
    int ms = 0;
    public SortThread(int ms){
        this.ms = ms;
    }
    public void run(){
        try {
            sleep(ms*10+10);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        System.out.println(ms);
    }
}

Name: Anonymous 2011-06-17 2:32

>>276
See >>279.

Name: Anonymous 2011-06-17 2:32

back to /b/

Name: Anonymous 2011-06-17 3:41

>>275
That's because your community is a bunch of cocksuckers who do nothing but praising python and bashing everything else.

Newer Posts