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

Pages: 1-4041-

Slowest sort you can think

Name: Anonymous 2012-07-22 3:02

What's the slowest non-Bogosort sort you can think of?

For me, it's
- Compute all the n! permutations of the list
- Do a breadth first search of the ordered permutation.
which, if done right, can be O(n*n!logn!).

Name: Anonymous 2012-07-22 3:03

Just implement it in Java.

Name: Anonymous 2012-07-22 3:09

>>2
ruby vm in java, interpreting php which walks FIOC ASTs implementing an x86 emulator running windows 3.1

Name: Anonymous 2012-07-22 3:12

>>3
Python implementation of Brainfuck interpreter running x86 emulator running JVM.

Name: Anonymous 2012-07-22 3:25

Why not add another for loop level on a bubble sort, just to be extra sure its sorted?

Name: Anonymous 2012-07-22 3:38

>>5
Still O(n*n!logn!)

Name: Anonymous 2012-07-22 4:50

Forget it, it's NP-complete

Name: Anonymous 2012-07-22 5:30

Instead of the slowest sort possible, try to implement a sort that is as slow as possible while still being reasonably[1] fast.

1. ^ Definition of “reasonable” here is that if you were to implement said sort in a closed-source program distributed for the general public, no one would notice something strange was going on.

Name: Anonymous 2012-07-22 5:43

>>8
Quicksort.

Name: Anonymous 2012-07-22 6:01

>>8
Recursive quicksort with immutable arrays copied each time.

Name: Anonymous 2012-07-22 6:34

Sleep sort with some large numbers

Name: Anonymous 2012-07-22 8:05

Isn't bubble sort the slowest?

Name: Anonymous 2012-07-22 8:19

>>12
It'sn't.

Name: Anonymous 2012-07-22 9:11

Bogosort. Essentially its the equivalent of throwing a deck of cards against a wall, picking them up, and seeing if they're sorted.  Runs at O(n!) with no upper bound.

Name: Anonymous 2012-07-22 9:51

>>14
Runs at O(n!) with no upper bound.
Runs with an upper bound of n! with no upper bound?
Bogosort is O(inf).
Also, Bogosort is not a non-Bogosort sort.

Name: Anonymous 2012-07-22 9:53

slowest sort
for(;;);
Θ(inf)

Name: Anonymous 2012-07-22 10:32

>>15
Bogosort my anus

Name: Anonymous 2012-07-22 11:09

>>16
That's good, except it should first check if the array is sorted already and if it is, unsort it.
To extend the concept, make a program that searches the memory of currently active processes and automatically detects any sorted arrays and messes them up on sight.

Name: Anonymous 2012-07-22 11:20

I see what OP's master plan is here.

#1) Develop top selling product
#2) Wait until the product is on 90% of all usable machines
#3) Release update including the following code:
     Add program to startup queue
     Disable any functionality allowing users to end the program
     Start 20 threads, each doing:
     Create int array of size 999,999,999
     Sort as slow as possible using what is essentially bogosort.
     ???
     Profit.

Genius.

Name: Anonymous 2012-07-22 12:47

Sleep sort that sleeps for 2n seconds, where n = given number.

Name: Anonymous 2012-07-22 12:48

>>19
Intel already does that with the Linux kernel to increase CPU sales.

Name: Anonymous 2012-07-22 14:04

>>18
Here, for Python:
# heron: make a mess out of your lists
heron = lambda: ((lambda f: f(f, set(), globals(), __import__('random').shuffle))(lambda heron, s, w, shuffle: ([(lambda v: ((s.add(id(v)), heron(heron, s, v, shuffle), shuffle(v) if isinstance(v, list) else None,) if isinstance(v, (dict, list, tuple, set)) and id(v) not in s else None, (s.add(id(v.__dict__)), heron(heron, s, v.__dict__, shuffle),) if getattr(v, '__dict__', None) and id(v.__dict__) not in s else None,))(p) for p in (w.values() if isinstance(w, dict) else w) if isinstance(w, (dict, list, tuple, set))],)), None,)[-1]

Name: Anonymous 2012-07-22 14:04

>>18
Here, for Python:
# heron: make a mess out of your lists
heron = lambda: ((lambda f: f(f, set(), globals(), __import__('random').shuffle))(lambda heron, s, w, shuffle: ([(lambda v: ((s.add(id(v)), heron(heron, s, v, shuffle), shuffle(v) if isinstance(v, list) else None,) if isinstance(v, (dict, list, tuple, set)) and id(v) not in s else None, (s.add(id(v.__dict__)), heron(heron, s, v.__dict__, shuffle),) if getattr(v, '__dict__', None) and id(v.__dict__) not in s else None,))(p) for p in (w.values() if isinstance(w, dict) else w) if isinstance(w, (dict, list, tuple, set))],)), None,)[-1]

Name: Anonymous 2012-07-22 18:33

>>23
That's not Python. Where's the FIOC?

Name: Anonymous 2012-07-22 18:50

>>24 lamb, duh, calc your ass

Name: Anonymous 2012-07-22 19:21

>>24
takes a backseat when show-off mode is in effect

Name: Anonymous 2012-07-23 6:59

>>1
This joke was funny the first time when I have heard it, that must be around year 1999.

Name: Anonymous 2012-07-24 11:06

>>8

Use an O(n logn) sort but pile on constant factor non-optimisations on. Don't do any bubble sort et al bullshit. It'll show for large inputs.

Name: Anonymous 2012-07-24 11:30

miracle sort

Name: Anonymous 2012-07-24 11:32

O(log n!) is still just O(log n) so you could hide a lot of shit in there.

Name: Anonymous 2012-07-24 11:46

>>30
logn! and logn differ so much that that's not even wrong.
http://www.wolframalpha.com/input/?i=plot+log+n+and+log+%28n!%29+from+1+to+30

Hint: the factorial of n is not a constant factor.

Name: Anonymous 2012-07-24 12:22

inb4 slowpoke sort

Name: Anonymous 2012-07-24 12:40

check em dubs sort

Name: Anonymous 2012-07-24 12:44

>>31
Learn basic mathematics you stupid piece of shit.

Name: Anonymous 2012-07-24 12:59

>>34
And what do you do for a living?

Name: Anonymous 2012-07-24 13:48

>>31
Stephen Wolfram's parents were Jewish refugees who emigrated from Westphalia, Germany, to England in 1933.
But you already knew that, kike.

Name: Anonymous 2012-07-24 14:19

Random sort. Try a combination and check if it's right; if not, repeat. It has unpredictable time constraints, and doesn't necessarily generate the correct result, ever. Making it effectively O(inf).

Name: Anonymous 2012-07-24 14:37

public static void bogoSort(ArrayList<String> array){
    // OH GOD WHAT HAVE I DONE
    boolean sorted = false;
    int iter = 0;
   
    while (!sorted){
        iter += 1;
        System.out.println(iter + ": " + array);
       
        Collections.shuffle(array);
        for (int i = 0; i < array.size() - 1; i++){
            if (Integer.parseInt(array.get(i)) > Integer.parseInt(array.get(i + 1))){
                break;
            } else if (i == array.size() - 2){
                System.out.println("Solution found! " + array);
                    System.out.println("Sorted in " + iter + " iterations!");
                sorted = true;
            }
        }
    }
}

Name: Anonymous 2012-07-24 16:50

>>37
Does not it converge towards n!?

Name: Anonymous 2012-07-24 16:55

>>34
You learn basic mathematics, you piece of shit.
f(x) ∈ O(g(x)) ~~ ∃k>0,x0.∀x>x0.f(x)<=g(x)*k
Look at the plot I linked. Guess what At exactly x0 = 2, k = 1, for every x larger than x0, log n! is larger than log n. Holy shit!! What will that mean? Maybe that log n ∈ O(log n!) and not the other way around.
That's even written on fucking wikipedia, that's how retarded you can get.

Name: Anonymous 2012-07-24 19:22

>>35
Listen you fucktard, memory in computers is limited, therefore everything is O(1).

What now bring it on

Name: Anonymous 2012-07-24 19:24

>>35,40
Lmao faggot I do your mom for a living what do you do?

Name: Anonymous 2012-07-24 19:26

>>42
lololol faggot go fuck a tired dog

Name: cosmic ray sorting 2012-07-24 21:59

def crs(l):
    while not all(l[i-1]<=l[i]for i in range(1,len(l))):
        pass

Name: 40 2012-07-24 22:40

>>42
I'm an Associate Professor of Electrical Engineering at Princeton University.

Name: Anonymous 2012-07-24 22:52

>>45
Hey fag, tell your mom I said hi.

Name: Anonymous 2012-07-24 23:14

>>44
I see what you did there.

Name: Anonymous 2012-07-24 23:49

Bureaucracy.

Name: Anonymous 2012-07-24 23:56

>>45
I'm so sorry, can I do anything for you?

Name: Anonymous 2013-12-01 13:26

░░░░░░░░░░░▄▄▄▄▄░░░░░░░░░░░░░░░░░░░░░ 
░░░░░░░░░▄▄█████████▄▄░░░░░░░░░░░░░░░ 
░░░░░░▄▀▀▀▀█▀▀▀▀▀▀█████▄░░░░░░░░░░░░░ 
░░░░▄██████░░░░░░░░░░░▀██░░░░░░░░░░░░ 
░░░▐██████▌░░░░░░░░░░░░░▐▌░░░░░░░░░░░ 
░░░███████▌░░░░░░░░░░░░░░█░░░░░░░░░░░ 
░░▐████████░░░░░░░░░░░░░░░█░░░░░░░░░░ 
░░▐██████▌░░░░░▄▀▀▀▀▀▄░▀░▄▄▌░░░░░░░░░ 
░░░█▀▀███▀░░░░░░▄▀█▀░░░▐▄▄▄▌░░░░░░░░░ 
░░▐░▌▀▄░░░░░░░░░░▄▄▄▀░░░▌▀░▌░░░░░░░░░ 
░░░▌▐░░▌░░░░░░░░░░░▀░░░░▐░▐░░░░░░░░░░ 
░░░▐░▀▄▐░░░░░░░░░░░▌▌░▄▄░▐░▌░░░░░░░░░ 
░░░░▀█░▄▀░░░░░░░░░▐░▐▄▄▄▄▀▐░░░░░░░░░░ 
░░░░░▌▀░▐░░░░░░░░▄▀░░▀▀▀▀░▌░░░░░░░░░░ 
░░░░░▐░░░░░░░░░▌░░░▄▀▀▀▀▄▐░░░░░░░░░░░ 
░░░░░▌░░░░░░░░░▐░░░░░▄▄░░▌░░░░░░░░░░░ 
░░░░█▀▄░░░▐░▐░░░░░░░░░░░█░░░░░░░░░░░░ 
░░░█░█░▀▀▄░▌░█░░░▀▀▄▄▄▄▀░░░░░░░░░░░░░ 
░░█░░░▀▄░░▀▀▄▄█░░░░░▄▀░░░░░░░░░░░░░░░ 
░░█░░░░░▀▄░░░░▀▀▄▄▄▀▐░░░░░░░░░░░░░░░░ 
░░█░░░░░░░▀▄░░░░░▐░▌▐░░░░░░░░░░░░░░░░ 
░░░█░░░░░░░░▀▄░░░▌░▐▌▐░░░░░░░░░░░░░░░ 
░░░░█░░░░░░░░░█░▐░▄▄▌░█▀▄░░░░░░░░░░░░ 
░░░░░█░░░░░░░░░█▌▐░▄▐░░▀▄▀▀▄▄░░░░░░░░ 
░░░░░░█░░░░░░░░░▀▄░░▐░░░▀▄░░░▀▀▄▄░░░░ 
░░░░░░░▀▄░▄▀█░░░░░█░░▌░░░░▀▄░░░░░█░░░ 

Name: Anonymous 2013-12-01 14:15

When I want a slow sort I use quicksort

>>50
who are you quoting?

Don't change these.
Name: Email:
Entire Thread Thread List