Skip to content
tansuasiciPublic

About

A simple BogoSort algorithm implementation in Java

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BogoSort Algorithm in Java

A simple implementation of the BogoSort (permutation sort) algorithm in Java.

How It Works

BogoSort repeatedly shuffles the array randomly until it happens to be sorted. It is one of the most inefficient sorting algorithms and is mainly used for educational purposes.

  1. Check if the array is sorted.
  2. If sorted, print the result and stop.
  3. If not, randomly shuffle the array using Fisher-Yates shuffle.
  4. Repeat from step 1.

Time Complexity

Case Complexity
Best O(n)
Average O(n * n!)
Worst O(∞)

Usage

Compile and run:

javac src/BogoSort.java
java -cp src BogoSort

About

A simple BogoSort algorithm implementation in Java

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages