Bogo Sort Visually Explained #5

preview_player
Показать описание
Bogo Sort Visually Explained.

Bogo Sort, often referred to humorously as "stupid sort" or "monkey sort," is a highly inefficient and largely theoretical sorting algorithm. It operates on the principle of generating random permutations of its input until it stumbles upon a sorted sequence. Specifically, the algorithm repeatedly shuffles the array elements in a random order and then checks to ascertain if the resulting sequence is sorted. This process is iterated indefinitely until the array is found to be in the correct sorted order. Due to its reliance on sheer luck for sorting, the algorithm's performance is extraordinarily poor, with an unbounded worst-case time complexity, rendering it impractical for real-world applications. Bogo Sort serves more as a humorous example of how not to approach algorithm design rather than a viable sorting method.
Рекомендации по теме
Комментарии
Автор

If you believe in the alternate universe theory, there's a timeline where bogo sort works perfectly every time and nobody knows why.

mendenhall
Автор

Correction:- The complexity is O(n!) not O(n).

Byte_Quest
Автор

Bogo sort deserves respect for who he is.

Bleak_Hope
Автор

Chad bogo sort enthusiasts when it works first try

crystal_link
Автор

Its worst case scenario is always infinity and best case scenario is always 1 iteration

Ескендір-бр
Автор

Something i saw on another comment was that in an alternate universe, bogo sort has worked every single time, without fail.

Stikkz-true
Автор

best case it is O(1)

overage case is O(n!)

worst case it goes indefinitely

einkar
Автор

i think this should be done with a recursive method, would work so much better

illegallylexi