Original
Index
Monkey sort
Sort diamonds (Diamond sort)
Demon Sort
Bead Sort
Sort by Goblin (order of the goods)
Smart Design Sequencing
1. Monkey sort (provider cy1306110516)
The idea of the monkey sort originates from the famous Infinite monkey theorem.
Since the monkeys can knock out "Hamlet", what is the sort of a mere order?
Ideas:
Determine if the array is ordered, and if it is unordered, go to the next step.
Randomly scrambling the array, back to the previous step.
Applicable crowd:
Ouhuang
Complexity of Time:
Worst case O (∞)
Best Case O (n)
Algorithm implementation:
1#include <bits/stdc++.h>2 using namespacestd;3 intn,a[100005];4Inlinevoidrandom_ () {5 for(intI=1; i<=n;i++) Swap (A[i],a[i+rand ()% (n-i+1)]);6 //upset, ac all by RP7 }8InlineBOOLCheck () {9 for(intI=2; i<=n;i++)if(a[i]<a[i-1])return false;Ten return true; One //Judging whether it is orderly A } -InlinevoidBogo_sort () { - while(!check ()) the random_ (); - //Core Code - } - intMain () { +scanf"%d",&n); - Srand (Time (NULL)); + for(intI=1; i<=n;i++) scanf ("%d",&a[i]); A Bogo_sort (); at for(intI=1; i<=n;i++) printf ("%d", A[i]); - return 0; -}//provided by cy1306110516
2. Diamond sorting (provider Darth_vader)
The idea of a sort of diamond (aka diamond) stems from the work of evolutionary biologist Jared Daimond, "Guns, Germs and Steel."
Ideas:
For each item in the array, create an equal number of human tribes.
Allow them to develop independently.
The first one to show the biggest guns, and so on.
Applicable crowd:
The very far future ruling class
Complexity of Time:
O (n), constant is 13,000 years.
Code implementation:
Not currently
3. Demon Sort (provider Darth_vader)
The idea of demonic sequencing stems from the Maxwell Demon hypothesis of the 19th century British physicist James Clerk Maxwell.
Ideas:
Create such a gas: each molecule moves at a rate proportional to each number in the array.
The gas is poured into a sealed box, which is split in two, with a small hole in the middle to the sides.
A small hole can pass through only one molecule at a time.
Each time a small hole is opened to allow specific molecules to pass through.
After that long time, the box will be cold on one side of the hot side.
For each side, divide and conquer the algorithm.
Applicable crowd:
Maxwell's Demons
Time-Complicated:
O (n!)
Code implementation:
Not currently
4. Bead sorting (provider 502_bad_gateaway)
The idea of the sorting of beads stems from the long-standing abacus of Chinese history. Fog
Ideas:
For each number, we use a row of beads to indicate.
Fold the beads together to make them fall naturally.
The number of beads per layer is the value of that position.
Applicable crowd:
Oier of the Abacus
Complexity of Time:
This one... Uh, uh, look what you said.
Code implementation:
Wait, ha, I'm knocking.
5.CounselingSort by Goblin (provider 502_bad_gateaway)
Order ... Very much.
Ideas:
When I=0 or a[i]>a[i-1], i++.
Otherwise exchange A[i] and A[i-1],i--。
Applicable crowd:
Normal human
Complexity of Time:
O ( n^2n2)
Code implementation:
1 voidGnome_sort (intunsorted[]) {2 inti =0;3 while(I <unsorted. Length) {4 if(i = =0|| Unsorted[i-1] <= Unsorted[i]) i++;5 Else{6 intTMP =Unsorted[i];7Unsorted[i] = unsorted[i-1];8Unsorted[i-1] =tmp;9i--;Ten } One } A}//provided by Darth_vader
6. Intelligent design Sequencing (provider Darth_vader)
The idea of intelligent design sequencing originates from the theory of Intelligent design (Theory of Wisdom).
Ideas:
The
assumes that we have some numbers (which make up the given array), then the probability that they are exactly sorted into the given array is \frac{1}{n!} < Span class= "Mopen nulldelimiter" > n! < Span class= "Mord mtight" >1?
In the face of such a small possibility, we assert that such arrays are randomly occurring, rather than decisive.
There is reason to believe that such an array is given by a sort of self-willed person.
Since our cognition of sequencing is limited to increasing or decreasing, it is irrational to figure out the behavior of the sequencer's intention.
So be assured that the array has been sorted!
Applicable crowd:
Lazy Man
Complexity of Time:
O (0), of course the input is O (n)
Code implementation:
1 #define donothing return2void intelligentdesignsort (int list[]) {3 donothing; 4 }// provider Darth_vader5
A bunch of messy, never-serious sorting algorithms.