Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

Difference between qsort() and sort() ?

$
0
0

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++ ?

MY SOLUTIONS using sort() which got accepted http://www.codechef.com/viewsolution/3653269

using qsort of stdlib.h which gave a wrong answer http://www.codechef.com/viewsolution/3652347


Viewing all articles
Browse latest Browse all 39796

Trending Articles