A O ( n ) time and O ( 1 ) extra space C # program to sort an array according to given indexes
using System ; public class Test { static int [ ] arr = new int [ ] { 50 , 40 , 70 , 60 , 90 } ; static int [ ] index = new int [ ] { 3 , 0 , 4 , 1 , 2 } ;