Driver code
let arr = [ 1 , 8 , 3 , 9 , 10 , 10 , 2 , 4 ] ; let n = arr . length ; cycleSort ( arr , n ) ; document . write ( " " + " " ) ; for ( let i = 0 ; i < n ; i ++ ) document . write ( arr [ i ] + " " ) ;