Can you see why i am not getting the right output

in the while loop you should compare i with start and end not a[i] with a[start] and a[end]