sort vector by index