Driver Code
$ arr = array ( 10 , 30 , 20 , 40 , 50 , 60 , 70 ) ; $ n = sizeof ( $ arr ) ; echo " Given ▁ array ▁ is ▁ " . " STRNEWLINE " ; printArray ( $ arr , $ n ) ; sortByOneSwap ( $ arr , $ n ) ; echo " Sorted ▁ array ▁ is ▁ " . " STRNEWLINE " ; printArray ( $ arr , $ n ) ;