bogo sort best case complexity on worst case complexity o average case complexity onn1 check the array is inorder bogo sort best case complexity o n worst case complexity o average case complexity o n n 1 check the array is inorder
import random

def bogo_sort(arr, simulation=False):
    
    
    iteration = 0
    if simulation:
        print("iteration",iteration,":",*arr)
    
    def is_sorted(arr):
        
        i = 0
        arr_len = len(arr)
        while i+1 < arr_len:
            if arr[i] > arr[i+1]:
                return False
            i += 1
            

        return True
    while not is_sorted(arr):
        random.shuffle(arr)
        
        if simulation:
            iteration = iteration + 1
            print("iteration",iteration,":",*arr)
            
    return arr