>> a = [1,3; 3,4; 3,6; 4,8]
a =
1 3
3 4
3 6
4 8
>> tmp = sortrows(a,2);
>> [tmp(1:2:end,:);flipud(tmp(2:2:end,:))]
ans =
1 3
3 6
4 8
3 4
@Vishal Sharma: did you know that the less effort you put into solving your own homework problems then the less you will learn. Also note that copying someone else's works and presenting it as your own is called plagiarism, and in many countries is considered a serious criminal offense.