Algorithm For Insertion In An Array