Sort: gmem selection sort working