Steps to Solve this

 

1.initialize array

 

2.Choose start index

 

3.Choose end index

 

4.Swap the elements using temp variable