[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Found Snorlax Sort on Reddit, never head of it before, apparently
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 15
Thread images: 1
File: image.gif (36 KB, 450x421) Image search: [Google]
image.gif
36 KB, 450x421
Found Snorlax Sort on Reddit, never head of it before, apparently 0(1) complexity for unlimited inputs. I don't know much about coding, but can someone explain how this works? Search Snorlax Sort on GitHub
>>
So I read the read me and it sounds like that to get this O(1) there is a downside where it doesn't work 100% of the time. So couldn't you just run it several times? O(1) beats everything we have right now (as far as I understand) so even with this drawback it sounds like it would be really good?
>>
this is a joke right?
  public int[] sort(int[] snorlax) {
return snorlax;
}
>>
>>52087433
I don't know Java but doesn't that just return the input ?
>>
>>52087463
no shit.

this is just a dumb ass joke.

hell I might send a pull request to make it Generic just for keks.
>>
>>52087480
So it is the most efficient sorting algorithm ever but it only works on certain inputs? Genius.
>>
>>52087480
Make it Generic, this is so stupid it just might become a thing
>>
>>52087268
The more I read, the stupider it gets
>>
There is actually an algorithm called soft heaps that will only semi-sort numbers. It has been used to get the best minimum spanning tree algorithm.
>>
>https://github.com/CMMCD/Snorlax/blob/master/SnorlaxJava/snorlax.java
It's a joke, how'd you not realize this?
It's O(1) because it just returns the array, and of course it works if the input is already sorted.

The likelyhood of a sorted output is 1/n!, where n is the length if the input.
/** Snorlax is an advanced sorting algorithm with extremely high efficiency.
* Note that this high efficiency comes with certain accuracy drawbacks outlined in the readme.
*
* @author github.com/CMMCD/
* @version 1.3
*/

public class snorlax {

// Your Snorlax's name.
private String name;

/** Class constructor.
*
* @param name What you choose to name your Snorlax.
*/
public snorlax(String name){
this.name = name;
}

/** Snorlax's sorting algorithm.
*
* @param snorlax Integer Array passed to Snorlax for sorting.
* @return The usualy* sorted input. *See readme for more information*
*/
public int[] sort(int[] snorlax) {
return snorlax;
}

/** Snorlax's sorting algorithm, with output instead of return.
* Note that the output is usualy* the sorted input. *See readme for more information*
*
* @param snorlax Integer Array passed to Snorlax for sorting.
*/
public void snorlaxSort(int[] snorlax) {
int[] snorlaxSorted = sort(snorlax);
System.out.println("Greetings, I am " + name + "! Here is your sorted array, enjoy!");
String snorlaxSpeak = "";
for (int zzz : snorlaxSorted) snorlaxSpeak += zzz + " ";
System.out.println(snorlaxSpeak);
}
}
>>
>>52088462
Is it more efficient than Snorlax sort?
>>
>>52088554
So it's the most efficient sorting alg ever made but has a chance to fail on some inputs?

Pretty troll
>>
So did anyone ever figure out the complexity of sleep sort?
>>
>>52088643
O(size of largest input) I guess
>>
>>52088554
Code is surprisingly clean and well documented for something so stupid
Thread replies: 15
Thread images: 1

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.