Less Time Complexity

After Each for loop, the max element was sent the last index of the Array. You dont have to go to the until last index of the arr every loop. This will be helpful for your Algrotihm.