Why the code is giving wrong output??
Code https://ide.codingblocks.com/s/118357
Problem in Quick Sort
I want to know why the code is giving wrong output when I use pivot instead of a[end] since I think both mean the same thing (since,pivot=a[end])?
@ratulhans You have to make changes in the array while swapping. If you do swap(a[i],pivot), swapping will not be done in the array. Just variable pivot will now have a[i] and a[i] will have pivot. a[end] will remain unchanged.