This algorithm used the concept of queue where one person stand in front of the queue and another person standing back of the queue, move accordingly and if not sorted, the outer_loop(Manager) enforce the inner_loop(Worker) to start again and again until it is sorted.