# Bogo Sort

> The Bogo Sort is an algorithm that randomly shuffles elements until the list happens to be sorted.

## What is bogosort and how slow is it?

The inefficient sorting algorithm that randomly rearranges elements until they are sorted. Extremely slow with average time complexity of O((n+1)!).

- Topic: Inefficient Sorting Algorithms
- Type: algorithm, concept

## Interview questions

### Is bogosort a real algorithm anyone uses?

No, it is a joke used to teach complexity. It is correct but uselessly slow.

### Can bogosort run forever?

The random version has no upper bound on running time, though it finishes with probability 1. Its expected time grows factorially.

### Bogosort vs bozo sort: what is the difference?

Bogosort shuffles the whole list each try. Bozo sort swaps two random elements each try. Both are joke sorts.

## Related cards

- [Bozo Sort](https://wonderium.dev/algorithms/bozo-sort.md)
- [Perm Sort](https://wonderium.dev/algorithms/perm-sort.md)
- [O(n!)](https://wonderium.dev/algorithms/o-n-factorial.md)
- [Factorial](https://wonderium.dev/algorithms/factorial.md)
- [Math.random()](https://wonderium.dev/js/math-random.md)

---

- Level: [Algorithms](https://wonderium.dev/algorithms.md)
- HTML version: https://wonderium.dev/algorithms/bogo-sort
- Last updated: 2026-11-25
