Find the last sorted element. Move the element right until encountering a larger element. Repeat that until sorted (red bar reaches the end). Here I optimized the process of finding the last sorted element