Then, in the next iteration it is safe for to look for the maximum from the location of the current maximum and can put the former maximum element at the location just before the current maximum value by interchanging appropriately to minimize the search space.