Not understood the logic

did not understand 1st condition when counter=1 ,how arr[j+1]=val is said to be arr[o]=11…