bogosort visualization

watch the bogosort algorithm shuffle and check for order from left to right

bogosort algorithm
every second, exactly one action happens: either shuffle the array (all bars turn black) or check if one element is in order (turn it gray if yes, or reset if no).

Iterations: 0 | Status: Stopped

how it works

algorithm steps:

  1. shuffle the array randomly (all bars return to black)
  2. check the first element (always highlight it gray)
  3. check the next element: if it's ≥ the previous, highlight it gray
  4. if an element is < the previous, stop and go back to step 1
  5. if all elements get highlighted, the array is sorted!
  6. each step takes exactly 300 miliseconds

visual indicators:

  • normal bars (unsorted or incorrect position)
  • gray bars (correctly ordered from the left)