allalgorithms-python

Stooge Sort

Stooge sort is a recursive sorting algorithm. It is notable for its exceptional bad time complexity of O(n^(log 3 / log 1.5)) = O(n^2.7095…). The running time of the algorithm is thus slower compared to reasonable sorting algorithms, and is slower than Bubble sort, a canonical example of a fairly inefficient sort. It is however more efficient than Slowsort.

Install

pip install allalgorithms

Usage

from allalgorithms.sorting import stooge_sort

arr = [77, 2, 10, -2, 1, 7]

print(stooge_sort(arr))
# -> [-2, 1, 2, 7, 10, 77]

API

stooge_sort(array)

Returns a sorted array

Params:
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy