I tried solving the question HORSES < http://www.codechef.com/problems/HORSES > , according to my algorithm, I had to sort the array and compare the adjacent entries for minimum difference. My solution where I used qsort function of stdlib.h gave a WRONG ANSWER whereas when I used sort function of algortithm header file, it got accepted.
Whats the difference between the two sorting functions?
and is the use of algorithm.h only limited to C++ ?
using sort() which got accepted
using qsort of stdlib.h which gave a wrong answer