digplanet beta 1: Athena
Share digplanet:

Agriculture

Applied sciences

Arts

Belief

Business

Chronology

Culture

Education

Environment

Geography

Health

History

Humanities

Language

Law

Life

Mathematics

Nature

People

Politics

Science

Society

Technology

Stooge sort
Sorting stoogesort anim.gif
Visualization of Stooge sort.
Class Sorting algorithm
Data structure Array
Worst case performance O(nlog 3 /log 1.5)
Worst case space complexity O(n)

Stooge sort is a recursive sorting algorithm with a time complexity of O(nlog 3 / log 1.5 ) = O(n2.7095...). The running time of the algorithm is thus slower compared to efficient sorting algorithms, such as Merge sort, and is even slower than Bubble sort, a canonical example of a fairly inefficient and simple sort.

The algorithm is defined as follows:

  • If the value at the end is smaller than the value at the start, swap them.
  • If there are more than 1 elements between start and end of the list, then:
    • Stooge sort the initial 2/3 of the list
    • Stooge sort the final 2/3 of the list
    • Stooge sort the initial 2/3 of the list again
  • else: exit the procedure

The algorithm gets its name from slapstick routines of The Three Stooges, in which each stooge hits the other two.[citation needed]

Implementation[edit]

 function stoogesort(array L, i = 0, j = length(L)-1)
     if L[j] < L[i] then
         L[i] ↔ L[j]
     if (j - i + 1) > 2 then
         t = (j - i + 1) / 3
         stoogesort(L, i  , j-t)
         stoogesort(L, i+t, j  )
         stoogesort(L, i  , j-t)
     return L

References[edit]

External links[edit]



Original courtesy of Wikipedia: http://en.wikipedia.org/wiki/Stooge_sort — Please support Wikipedia.
This page uses Creative Commons Licensed content from Wikipedia. A portion of the proceeds from advertising on Digplanet goes to supporting Wikipedia.
284 videos foundNext > 

Stooge Sort

Visualization and "audibilization" of the Stooge Sort algorithm. Sorts a random shuffle of the integers [1,64] using Stooge sort. It uses the implementation ...

Stooge sort (30)

http://nayuki.eigenstate.org/page/sorting-algorithms-demo-java.

IGGY POP and the STOOGES "search and destroy"

Fan vid for IGGY POP and the STOOGES's "search and destroy" The movies are "Full metal jacket" and "Apocalypse now".

The Three Stooges Trailer Thoughts....

Fans have finally gotten their first look at the Farrelly Brothers passion project - The Three Stooges. http://www.HaphazardStuff.com Moe, Larry and Curly re...

The Three Stooges VCR Game-Pt. 1

Way back in the old day's of the 1980's, before the interweb and iphones, when all we had was the 8-bit NES to play games, there was a brief new form of grou...

Sean Hayes' STOOGE FEST 2012 - (episode 3)

The art of "stooging"...well, sort of.

Happy Garner, Brother of a Stooge and Master of Doublespeak

Harold "Happy" Garner, lives in Gaithersburg, MD and is the brother of Paul "Mousie" Garner who performed in Ted Healey's Stooges and knew Moe, Larry, Curly ...

Harper stooge attacks ailing Premier, Danny Williams, who just had heart surgery.mpg

Meanspirited is all I can say about this. The stooge in question is a former director of communication for the Canadian Prime Minister's Office. He is not a ...

the stooge's ep 1 bridge jumping

Me and my friends are all idiots do anything you see here at your own risk we have been idiots all our life's and that sort of makes us professional we can n...

Stooge Identification Fail

A 3 Stooges greeting card with authentic stooge sounds... well, sort of...

284 videos foundNext > 

We're sorry, but there's no news about "Stooge sort" right now.

Loading

Oops, we seem to be having trouble contacting Twitter

Support Wikipedia

A portion of the proceeds from advertising on Digplanet goes to supporting Wikipedia. Please add your support for Wikipedia!